From 4bccf94299923bf752713039933fbe6983d3c890 Mon Sep 17 00:00:00 2001 From: ErickSkrauch Date: Sun, 8 Jan 2017 14:55:28 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=D0=BC=D0=BD=D0=BE=D0=B3=D0=BE=20?= =?UTF-8?q?=D1=83=D1=81=D0=BA=D0=BE=D1=80=D0=B5=D0=BD=D0=BE=20=D0=B2=D1=80?= =?UTF-8?q?=D0=B5=D0=BC=D1=8F=20=D0=BF=D1=80=D0=BE=D1=85=D0=BE=D0=B6=D0=B4?= =?UTF-8?q?=D0=B5=D0=BD=D0=B8=D1=8F=20backend=20=D1=82=D0=B5=D1=81=D1=82?= =?UTF-8?q?=D0=BE=D0=B2=20=D0=B7=D0=B0=20=D1=81=D1=87=D1=91=D1=82=20=D0=B8?= =?UTF-8?q?=D1=81=D0=BF=D0=BE=D0=BB=D1=8C=D0=B7=D0=BE=D0=B2=D0=B0=D0=BD?= =?UTF-8?q?=D0=B8=D1=8F=20=D0=BF=D1=80=D1=8F=D0=BC=D0=BE=D0=B3=D0=BE=20?= =?UTF-8?q?=D0=BE=D0=B1=D1=80=D0=B0=D1=89=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=BA?= =?UTF-8?q?=20=D1=84=D0=BE=D1=80=D0=BC=D0=B5=20=D0=BB=D0=BE=D0=B3=D0=B8?= =?UTF-8?q?=D0=BA=D0=B0,=20=D0=B0=20=D0=BD=D0=B5=20=D0=B8=D1=81=D0=BF?= =?UTF-8?q?=D0=BE=D0=BB=D0=BD=D0=B5=D0=BD=D0=B8=D1=8F=20=D0=B7=D0=B0=D0=BF?= =?UTF-8?q?=D1=80=D0=BE=D1=81=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../api/_support/FunctionalTester.php | 22 +++++++++++-------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/tests/codeception/api/_support/FunctionalTester.php b/tests/codeception/api/_support/FunctionalTester.php index cc985c6..a06b732 100644 --- a/tests/codeception/api/_support/FunctionalTester.php +++ b/tests/codeception/api/_support/FunctionalTester.php @@ -1,9 +1,10 @@ login('Admin', 'password_0'); + $form = new LoginForm(); + if ($login === null && $password === null) { + $form->login = 'Admin'; + $form->password = 'password_0'; } elseif ($login !== null && $password !== null) { - $route->login($login, $password); + $form->login = $login; + $form->password = $password; } else { throw new InvalidArgumentException('login and password should be presented both.'); } - $this->canSeeResponseIsJson(); - $this->canSeeAuthCredentials(false); - $jwt = $this->grabDataFromResponseByJsonPath('$.access_token')[0]; - $this->amBearerAuthenticated($jwt); + $result = $form->login(); + $this->assertInstanceOf(LoginResult::class, $result); + if ($result !== false) { + $this->amBearerAuthenticated($result->getJwt()); + } } public function notLoggedIn() {