From 669fac6d3d99b4cc9cb1e77577c5ae7e6355da2c Mon Sep 17 00:00:00 2001 From: eldadfux Date: Sun, 15 Sep 2019 21:56:04 +0300 Subject: [PATCH] Added more tests --- tests/e2e/Client.php | 2 +- tests/e2e/ConsoleTest.php | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/tests/e2e/Client.php b/tests/e2e/Client.php index ac5e81a98..5fd7c90a4 100644 --- a/tests/e2e/Client.php +++ b/tests/e2e/Client.php @@ -187,7 +187,7 @@ class Client curl_setopt($ch, CURLOPT_HTTPHEADER, $headers); curl_setopt($ch, CURLOPT_HEADERFUNCTION, function($curl, $header) use (&$responseHeaders) { $len = strlen($header); - $header = explode(':', strtolower($header), 2); + $header = explode(':', $header, 2); if (count($header) < 2) { // ignore invalid headers return $len; diff --git a/tests/e2e/ConsoleTest.php b/tests/e2e/ConsoleTest.php index 12adc3450..b4aa9f09a 100644 --- a/tests/e2e/ConsoleTest.php +++ b/tests/e2e/ConsoleTest.php @@ -71,7 +71,7 @@ class ConsoleTest extends TestCase ]); $session = $this->client->parseCookie($response['headers']['set-cookie'])['a-session-console']; -var_dump($response['headers']); + $this->assertEquals('http://localhost/success', $response['headers']['location']); $this->assertEquals("\n", $response['body']); @@ -81,26 +81,26 @@ var_dump($response['headers']); /** * @depends testLoginSuccess */ - public function xtestLogoutSuccess($data) + public function testLogoutSuccess($data) { + var_dump($data); $response = $this->client->call(Client::METHOD_DELETE, '/auth/logout', [ 'origin' => 'http://localhost', 'content-type' => 'application/json', 'cookie' => 'a-session-console=' . $data['session'], ], []); - var_dump($response); - $this->assertEquals('http://localhost/success', $response['headers']['location']); - $this->assertEquals("\n", $response['body']); + $this->assertEquals(200, $response['headers']['status-code']); + $this->assertEquals('success', $response['body']['result']); } - // public function testLogoutFailure() - // { - // $response = $this->client->call(Client::METHOD_DELETE, '/auth/logout', [ - // 'origin' => 'http://localhost', - // 'content-type' => 'application/json', - // ], []); + public function testLogoutFailure() + { + $response = $this->client->call(Client::METHOD_DELETE, '/auth/logout', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + ], []); - // $this->assertEquals('401', $response['body']['code']); - // } + $this->assertEquals('401', $response['body']['code']); + } } \ No newline at end of file