diff options
author | Frederic Guillot <fred@kanboard.net> | 2016-07-01 09:05:10 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2016-07-01 09:05:10 -0400 |
commit | 4b94714b3d45656b022228562478514024550732 (patch) | |
tree | c3f6d0ff938625187dd8faab0160e48391bd7069 /tests | |
parent | 5a7afc67d2a684e1401920efa2c86ec6204bf667 (diff) |
Fixed PHP error in UserHelper when having no user session
Diffstat (limited to 'tests')
-rw-r--r-- | tests/units/Helper/UserHelperTest.php | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/units/Helper/UserHelperTest.php b/tests/units/Helper/UserHelperTest.php index 10bbc58e..d5bd1789 100644 --- a/tests/units/Helper/UserHelperTest.php +++ b/tests/units/Helper/UserHelperTest.php @@ -31,6 +31,12 @@ class UserHelperTest extends Base $this->assertEquals('Project Viewer', $helper->getRoleName(Role::PROJECT_VIEWER)); } + public function testHasAccessWithoutSession() + { + $helper = new UserHelper($this->container); + $this->assertFalse($helper->hasAccess('UserCreationController', 'create')); + } + public function testHasAccessForAdmins() { $helper = new UserHelper($this->container); @@ -73,6 +79,15 @@ class UserHelperTest extends Base $this->assertTrue($helper->hasAccess('ProjectCreationController', 'createPrivate')); } + public function testHasProjectAccessWithoutSession() + { + $helper = new UserHelper($this->container); + $project = new ProjectModel($this->container); + + $this->assertEquals(1, $project->create(array('name' => 'My project'))); + $this->assertFalse($helper->hasProjectAccess('ProjectEditController', 'edit', 1)); + } + public function testHasProjectAccessForAdmins() { $helper = new UserHelper($this->container); |