From a675271ad71b7713d1b33bdba3c51b2b04813229 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 15 Nov 2015 12:50:33 -0500 Subject: Rewrite of session management --- tests/units/Helper/UserHelperTest.php | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'tests/units/Helper/UserHelperTest.php') diff --git a/tests/units/Helper/UserHelperTest.php b/tests/units/Helper/UserHelperTest.php index 4cc9fa65..eba977ee 100644 --- a/tests/units/Helper/UserHelperTest.php +++ b/tests/units/Helper/UserHelperTest.php @@ -6,7 +6,6 @@ use Kanboard\Helper\User; use Kanboard\Model\Project; use Kanboard\Model\ProjectPermission; use Kanboard\Model\User as UserModel; -use Kanboard\Core\Session; class UserHelperTest extends Base { @@ -24,7 +23,6 @@ class UserHelperTest extends Base $p = new Project($this->container); $pp = new ProjectPermission($this->container); $u = new UserModel($this->container); - $session = new Session; // We create our user $this->assertEquals(2, $u->create(array('username' => 'unittest', 'password' => 'unittest'))); @@ -36,7 +34,7 @@ class UserHelperTest extends Base $this->assertFalse($pp->isManager(1, 2)); // We fake a session for him - $session['user'] = array( + $this->container['sessionStorage']->user = array( 'id' => 2, 'is_admin' => false, 'is_project_admin' => true, @@ -51,7 +49,6 @@ class UserHelperTest extends Base $p = new Project($this->container); $pp = new ProjectPermission($this->container); $u = new UserModel($this->container); - $session = new Session; // We create our user $this->assertEquals(2, $u->create(array('username' => 'unittest', 'password' => 'unittest'))); @@ -63,7 +60,7 @@ class UserHelperTest extends Base $this->assertFalse($pp->isManager(1, 2)); // We fake a session for him - $session['user'] = array( + $this->container['sessionStorage']->user = array( 'id' => 2, 'is_admin' => false, 'is_project_admin' => false, @@ -78,7 +75,6 @@ class UserHelperTest extends Base $p = new Project($this->container); $pp = new ProjectPermission($this->container); $u = new UserModel($this->container); - $session = new Session; // We create our user $this->assertEquals(2, $u->create(array('username' => 'unittest', 'password' => 'unittest'))); @@ -90,7 +86,7 @@ class UserHelperTest extends Base $this->assertTrue($pp->isManager(1, 2)); // We fake a session for him - $session['user'] = array( + $this->container['sessionStorage']->user = array( 'id' => 2, 'is_admin' => false, 'is_project_admin' => false, @@ -105,7 +101,6 @@ class UserHelperTest extends Base $p = new Project($this->container); $pp = new ProjectPermission($this->container); $u = new UserModel($this->container); - $session = new Session; // We create our user $this->assertEquals(2, $u->create(array('username' => 'unittest', 'password' => 'unittest'))); @@ -117,7 +112,7 @@ class UserHelperTest extends Base $this->assertFalse($pp->isManager(1, 2)); // We fake a session for him - $session['user'] = array( + $this->container['sessionStorage']->user = array( 'id' => 2, 'is_admin' => false, 'is_project_admin' => true, @@ -132,7 +127,6 @@ class UserHelperTest extends Base $p = new Project($this->container); $pp = new ProjectPermission($this->container); $u = new UserModel($this->container); - $session = new Session; // We create our user $this->assertEquals(2, $u->create(array('username' => 'unittest', 'password' => 'unittest'))); @@ -144,7 +138,7 @@ class UserHelperTest extends Base $this->assertFalse($pp->isManager(1, 2)); // We fake a session for him - $session['user'] = array( + $this->container['sessionStorage']->user = array( 'id' => 2, 'is_admin' => false, 'is_project_admin' => false, @@ -159,7 +153,6 @@ class UserHelperTest extends Base $p = new Project($this->container); $pp = new ProjectPermission($this->container); $u = new UserModel($this->container); - $session = new Session; // We create our user $this->assertEquals(2, $u->create(array('username' => 'unittest', 'password' => 'unittest'))); @@ -171,7 +164,7 @@ class UserHelperTest extends Base $this->assertTrue($pp->isManager(1, 2)); // We fake a session for him - $session['user'] = array( + $this->container['sessionStorage']->user = array( 'id' => 2, 'is_admin' => false, 'is_project_admin' => false, -- cgit v1.2.3