From 928f80d569141601c4d8f6652b2ac0a2497c7be4 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Wed, 30 Jan 2019 22:25:57 -0800 Subject: Update unit tests --- tests/units/Auth/DatabaseAuthTest.php | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'tests/units/Auth') diff --git a/tests/units/Auth/DatabaseAuthTest.php b/tests/units/Auth/DatabaseAuthTest.php index 50ae3c7e..e2236837 100644 --- a/tests/units/Auth/DatabaseAuthTest.php +++ b/tests/units/Auth/DatabaseAuthTest.php @@ -46,17 +46,24 @@ class DatabaseAuthTest extends Base $this->assertFalse($provider->isValidSession()); - $this->assertEquals(2, $userModel->create(array('username' => 'foobar'))); + $this->assertEquals(2, $userModel->create(array('username' => 'user1'))); + $this->assertEquals(3, $userModel->create(array('username' => 'user2'))); - $_SESSION['user'] = array('id' => 2); + $_SESSION['user'] = array('id' => 2, 'role' => 'app-user'); $this->assertTrue($provider->isValidSession()); - $_SESSION['user'] = array('id' => 3); + $_SESSION['user'] = array('id' => 4, 'role' => 'app-user'); $this->assertFalse($provider->isValidSession()); $this->assertTrue($userModel->disable(2)); - $_SESSION['user'] = array('id' => 2); + $_SESSION['user'] = array('id' => 2, 'role' => 'app-user'); + $this->assertFalse($provider->isValidSession()); + + $_SESSION['user'] = array('id' => 3, 'role' => 'app-user'); + $this->assertTrue($provider->isValidSession()); + + $_SESSION['user'] = array('id' => 3, 'role' => 'app-admin'); $this->assertFalse($provider->isValidSession()); } } -- cgit v1.2.3