public function testParseMatch()
{
$params = array('library' => 'test_library', 'controller' => 'test_controllers', 'action' => 'test_action');
$request = new Request(array('params' => $params));
$match = array('library' => 'test_library', 'controller' => 'TestControllers', 'action' => 'test_action');
$this->assertTrue(Access::adapter('test_check')->parseMatch($match, compact('request', 'params')));
$match = array('controller' => 'TestControllers', 'action' => 'test_action');
$this->assertTrue(Access::adapter('test_check')->parseMatch($match, compact('request', 'params')));
$match = array('library' => 'test_library', 'action' => 'test_action');
$this->assertTrue(Access::adapter('test_check')->parseMatch($match, compact('request', 'params')));
$match = array('library' => 'test_library', 'controller' => 'TestControllers');
$this->assertTrue(Access::adapter('test_check')->parseMatch($match, compact('request', 'params')));
$match = array('library' => 'test_no_match', 'controller' => 'TestControllers', 'action' => 'test_action');
$this->assertFalse(Access::adapter('test_check')->parseMatch($match, compact('request', 'params')));
$match = 'TestControllers::test_action';
$this->assertTrue(Access::adapter('test_check')->parseMatch($match, compact('request', 'params')));
$match = 'TestControllers::*';
$this->assertTrue(Access::adapter('test_check')->parseMatch($match, compact('request', 'params')));
$match = '*::test_action';
$this->assertTrue(Access::adapter('test_check')->parseMatch($match, compact('request', 'params')));
$match = '*::*';
$this->assertTrue(Access::adapter('test_check')->parseMatch($match, compact('request', 'params')));
$match = array('library' => 'test_library', '*::*');
$this->assertTrue(Access::adapter('test_check')->parseMatch($match, compact('request', 'params')));
$match = array('library' => 'test_no_match', '*::*');
$this->assertFalse(Access::adapter('test_check')->parseMatch($match, compact('request', 'params')));
$match = null;
$this->assertFalse(Access::adapter('test_check')->parseMatch($match, compact('request', 'params')));
$test = function () {
return true;
};
$this->assertTrue(Access::adapter('test_closures')->parseMatch(array($test), compact('request', 'params')));
$test = function () {
return false;
};
$this->assertFalse(Access::adapter('test_closures')->parseMatch(array($test), compact('request', 'params')));
$this->assertFalse(Access::adapter('test_closures')->parseMatch(array(), compact('request', 'params')));
$params = array('controller' => 'lithium\\test\\Controller', 'action' => 'index');
$request = new Request(array('params' => $params));
$match = 'Controller::*';
$this->assertFalse(Access::adapter('test_check')->parseMatch($match, compact('request', 'params')));
$match = 'lithium\\test\\Controller::*';
$this->assertTrue(Access::adapter('test_check')->parseMatch($match, compact('request', 'params')));
}