1
0
Fork 0
mirror of synced 2024-06-25 17:50:38 +12:00

Added more tests

This commit is contained in:
eldadfux 2019-09-15 22:11:01 +03:00
parent 669fac6d3d
commit 9d35e6befa

View file

@ -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',