diff options
author | Frédéric Guillot <fguillot@users.noreply.github.com> | 2014-03-09 23:21:23 -0400 |
---|---|---|
committer | Frédéric Guillot <fguillot@users.noreply.github.com> | 2014-03-09 23:21:23 -0400 |
commit | 7749b8ed569f6d27b0bb2ed4c2040e8b61ed4422 (patch) | |
tree | ee101992e87d740bdf0362e35ea040c866986f5a /tests/AclTest.php | |
parent | 7bd4697dfca41a21f5857f83d6b29108fafb9a1e (diff) |
Automatic actions
Diffstat (limited to 'tests/AclTest.php')
-rw-r--r-- | tests/AclTest.php | 18 |
1 files changed, 6 insertions, 12 deletions
diff --git a/tests/AclTest.php b/tests/AclTest.php index 0996a51f..566d7245 100644 --- a/tests/AclTest.php +++ b/tests/AclTest.php @@ -1,24 +1,18 @@ <?php -require_once __DIR__.'/../models/base.php'; -require_once __DIR__.'/../models/acl.php'; +require_once __DIR__.'/base.php'; use Model\Acl; -class AclTest extends PHPUnit_Framework_TestCase +class AclTest extends Base { - public function setUp() - { - defined('DB_FILENAME') or define('DB_FILENAME', ':memory:'); - } - public function testAllowedAction() { $acl_rules = array( 'controller1' => array('action1', 'action3'), ); - $acl = new Acl; + $acl = new Acl($this->db, $this->event); $this->assertTrue($acl->isAllowedAction($acl_rules, 'controller1', 'action1')); $this->assertTrue($acl->isAllowedAction($acl_rules, 'controller1', 'action3')); $this->assertFalse($acl->isAllowedAction($acl_rules, 'controller1', 'action2')); @@ -28,7 +22,7 @@ class AclTest extends PHPUnit_Framework_TestCase public function testIsAdmin() { - $acl = new Acl; + $acl = new Acl($this->db, $this->event); $_SESSION = array(); $this->assertFalse($acl->isAdminUser()); @@ -51,7 +45,7 @@ class AclTest extends PHPUnit_Framework_TestCase public function testIsUser() { - $acl = new Acl; + $acl = new Acl($this->db, $this->event); $_SESSION = array(); $this->assertFalse($acl->isRegularUser()); @@ -74,7 +68,7 @@ class AclTest extends PHPUnit_Framework_TestCase public function testIsPageAllowed() { - $acl = new Acl; + $acl = new Acl($this->db, $this->event); // Public access $_SESSION = array(); |