From 9d35e6befaf102ed90276d0e84cc1370035d5656 Mon Sep 17 00:00:00 2001 From: eldadfux Date: Sun, 15 Sep 2019 22:11:01 +0300 Subject: [PATCH] Added more tests --- tests/e2e/ConsoleTest.php | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/tests/e2e/ConsoleTest.php b/tests/e2e/ConsoleTest.php index b4aa9f09a..780e2d3ea 100644 --- a/tests/e2e/ConsoleTest.php +++ b/tests/e2e/ConsoleTest.php @@ -75,15 +75,41 @@ class ConsoleTest extends TestCase $this->assertEquals('http://localhost/success', $response['headers']['location']); $this->assertEquals("\n", $response['body']); - return ['session' => $session]; + return [ + 'email' => $data['demoEmail'], + 'password' => $data['demoPassword'], + 'session' => $session + ]; } /** * @depends testLoginSuccess */ + public function testAccountSuccess($data) + { + $response = $this->client->call(Client::METHOD_GET, '/account', [ + 'origin' => 'http://localhost', + 'content-type' => 'application/json', + 'cookie' => 'a-session-console=' . $data['session'], + ], []); + + $this->assertEquals('Demo User', $response['body']['name']); + $this->assertEquals($data['demoEmail'], $data['body']['email']); + $this->assertEquals($data['demoPassword'], $data['body']['password']); + $this->assertEquals(false, $response['body']['confirm']); + $this->assertIsArray($response['body']['roles']); + $this->assertEquals('*', $response['body']['roles'][0]); + $this->assertEquals('user:' . $response['body']['$uid'], $response['body']['roles'][1]); + $this->assertEquals('role:1', $response['body']['roles'][2]); + + return $data; + } + + /** + * @depends testAccountSuccess + */ public function testLogoutSuccess($data) { - var_dump($data); $response = $this->client->call(Client::METHOD_DELETE, '/auth/logout', [ 'origin' => 'http://localhost', 'content-type' => 'application/json',