Skip to content

Commit 078b845

Browse files
committed
Adding test from 'Phally' to expand coverage of allow()
1 parent 957be00 commit 078b845

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

cake/tests/cases/libs/controller/components/auth.test.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,6 +900,16 @@ function testAllowedActionsWithCamelCaseMethods() {
900900
$result = $this->Controller->Auth->startup($this->Controller);
901901
$this->assertFalse($result, 'startup() should return false, as action is not allowed. %s');
902902

903+
$url = '/auth_test/delete';
904+
$this->Controller->params = Router::parse($url);
905+
$this->Controller->params['url']['url'] = Router::normalize($url);
906+
$this->Controller->Auth->initialize($this->Controller);
907+
$this->Controller->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login');
908+
$this->Controller->Auth->userModel = 'AuthUser';
909+
910+
$this->Controller->Auth->allow(array('delete', 'add'));
911+
$result = $this->Controller->Auth->startup($this->Controller);
912+
$this->assertTrue($result, 'startup() should return true, as action is allowed. %s');
903913
}
904914

905915
function testAllowedActionsSetWithAllowMethod() {
@@ -909,7 +919,6 @@ function testAllowedActionsSetWithAllowMethod() {
909919
$this->Controller->Auth->initialize($this->Controller);
910920
$this->Controller->Auth->allow('action_name', 'anotherAction');
911921
$this->assertEqual($this->Controller->Auth->allowedActions, array('action_name', 'anotheraction'));
912-
913922
}
914923

915924
/**

0 commit comments

Comments
 (0)