Skip to content

Commit

Permalink
Test renaming test as it does more then just test closures in match o…
Browse files Browse the repository at this point in the history
…ptions now.
  • Loading branch information
Richard Vanbergen committed May 26, 2011
1 parent 12d7289 commit 54ef9cb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions tests/cases/extensions/adapter/security/access/AuthRbacTest.php
Expand Up @@ -36,7 +36,7 @@ public function setUp() {
)
)
),
'test_match_closure' => array(
'test_closures' => array(
'adapter' => 'AuthRbac',
'roles' => array(
array(
Expand Down Expand Up @@ -187,35 +187,35 @@ public function testParseMatch() {

$match = true;
$test = function() { return true; };
$this->assertTrue(Access::adapter('test_match_closure')->parseMatch(array($test), $request));
$this->assertTrue(Access::adapter('test_closures')->parseMatch(array($test), $request));

$match = false;
$test = function() { return false; };
$this->assertFalse(Access::adapter('test_match_closure')->parseMatch(array($test), $request));
$this->assertFalse(Access::adapter('test_closures')->parseMatch(array($test), $request));

$match = false;
$this->assertFalse(Access::adapter('test_match_closure')->parseMatch(array(), $request));
$this->assertFalse(Access::adapter('test_closures')->parseMatch(array(), $request));
}

public function testMatchClosure() {
public function testClosures() {
$request = new Request(array('params' => array('controller' => 'test_controllers', 'action' => 'test_action')));

$user = $request->data = array('username' => 'test');
$authSuccess = array('checkSession' => false, 'success' => true);

$request->params['success'] = true;
$expected = array();
$result = Access::check('test_match_closure', $user, $request, $authSuccess);
$result = Access::check('test_closures', $user, $request, $authSuccess);
$this->assertIdentical($expected, $result);

$request->params['success'] = false;
$expected = array('message' => 'You are not permitted to access this area.', 'redirect' => '/');
$result = Access::check('test_match_closure', $user, $request, $authSuccess);
$result = Access::check('test_closures', $user, $request, $authSuccess);
$this->assertIdentical($expected, $result);

$request->params = array('controller' => 'TestControllers', 'action' => 'bad_action');
$request->params['success'] = true;
$result = Access::check('test_match_closure', $user, $request, $authSuccess);
$result = Access::check('test_closures', $user, $request, $authSuccess);
$expected = array('message' => 'You are not permitted to access this area.', 'redirect' => '/');
$this->assertIdentical($expected, $result);
}
Expand Down

0 comments on commit 54ef9cb

Please sign in to comment.