public function testRequireACL() { fAuthorization::setLoginPage('/index.php'); $acls = array('news' => array('*'), 'events' => array('read')); fAuthorization::setUserACLs($acls); $this->assertEquals(NULL, fAuthorization::requireACL('news', 'foo')); // This is a gross cli wrapper script since we have to test for exit $code = "fAuthorization::setLoginPage('/login/');"; $code .= "\$acls = array('news' => array('*'), 'events' => array('read'));"; $code .= "fAuthorization::setUserACLs(\$acls);"; $code .= "fAuthorization::requireACL('events', 'write');"; $this->assertEquals('http://example.com/login/', shell_exec('php ' . TEST_EXIT_SCRIPT . ' ' . escapeshellarg($code))); }