Skip to content

Commit

Permalink
Adding test from 'Phally' to expand coverage of allow()
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Oct 15, 2009
1 parent 957be00 commit 078b845
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion cake/tests/cases/libs/controller/components/auth.test.php
Expand Up @@ -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() {
Expand All @@ -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'));

}

/**
Expand Down

0 comments on commit 078b845

Please sign in to comment.