diff options
author | Frederic Guillot <fred@kanboard.net> | 2015-09-05 23:30:56 -0400 |
---|---|---|
committer | Frederic Guillot <fred@kanboard.net> | 2015-09-05 23:30:56 -0400 |
commit | 710f2c7bb046b43ec9878ae795a181101f6d7515 (patch) | |
tree | b62723b6b49c3b6bf2b3ca41a772f552464a9031 /tests/units/Model/UserSessionTest.php | |
parent | 94b38dd94bd819168163003beec8ef693f9d9839 (diff) |
Improve unit tests
Diffstat (limited to 'tests/units/Model/UserSessionTest.php')
-rw-r--r-- | tests/units/Model/UserSessionTest.php | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/tests/units/Model/UserSessionTest.php b/tests/units/Model/UserSessionTest.php new file mode 100644 index 00000000..31072e6a --- /dev/null +++ b/tests/units/Model/UserSessionTest.php @@ -0,0 +1,32 @@ +<?php + +require_once __DIR__.'/../Base.php'; + +use Core\Session; +use Model\UserSession; + +class UserSessionTest extends Base +{ + public function testIsAdmin() + { + $s = new Session; + $us = new UserSession($this->container); + + $this->assertFalse($us->isAdmin()); + + $s['user'] = array(); + $this->assertFalse($us->isAdmin()); + + $s['user'] = array('is_admin' => '1'); + $this->assertFalse($us->isAdmin()); + + $s['user'] = array('is_admin' => false); + $this->assertFalse($us->isAdmin()); + + $s['user'] = array('is_admin' => '2'); + $this->assertFalse($us->isAdmin()); + + $s['user'] = array('is_admin' => true); + $this->assertTrue($us->isAdmin()); + } +} |