Permalink
Browse files

Adding test from 'Phally' to expand coverage of allow()

  • Loading branch information...
1 parent 957be00 commit 078b84500b2ee50e600640cfe64e10fdb5be951a @markstory markstory committed Oct 15, 2009
Showing with 10 additions and 1 deletion.
  1. +10 −1 cake/tests/cases/libs/controller/components/auth.test.php
@@ -900,6 +900,16 @@ function testAllowedActionsWithCamelCaseMethods() {
$result = $this->Controller->Auth->startup($this->Controller);
$this->assertFalse($result, 'startup() should return false, as action is not allowed. %s');
+ $url = '/auth_test/delete';
+ $this->Controller->params = Router::parse($url);
+ $this->Controller->params['url']['url'] = Router::normalize($url);
+ $this->Controller->Auth->initialize($this->Controller);
+ $this->Controller->Auth->loginAction = array('controller' => 'AuthTest', 'action' => 'login');
+ $this->Controller->Auth->userModel = 'AuthUser';
+
+ $this->Controller->Auth->allow(array('delete', 'add'));
+ $result = $this->Controller->Auth->startup($this->Controller);
+ $this->assertTrue($result, 'startup() should return true, as action is allowed. %s');
}
function testAllowedActionsSetWithAllowMethod() {
@@ -909,7 +919,6 @@ function testAllowedActionsSetWithAllowMethod() {
$this->Controller->Auth->initialize($this->Controller);
$this->Controller->Auth->allow('action_name', 'anotherAction');
$this->assertEqual($this->Controller->Auth->allowedActions, array('action_name', 'anotheraction'));
-
}
/**

0 comments on commit 078b845

Please sign in to comment.