Fixing parameter ordering error of array_map in AuthComponent::allow(). Adding test.

This commit is contained in:
jperras 2009-09-21 12:09:06 -04:00
parent 42017e95c6
commit 2b0d13733e
2 changed files with 13 additions and 2 deletions

View file

@ -600,7 +600,7 @@ class AuthComponent extends Object {
if (isset($args[0]) && is_array($args[0])) { if (isset($args[0]) && is_array($args[0])) {
$args = $args[0]; $args = $args[0];
} }
$this->allowedActions = array_merge($this->allowedActions, array_map($args, 'strtolower')); $this->allowedActions = array_merge($this->allowedActions, array_map('strtolower', $args));
} }
} }

View file

@ -899,6 +899,17 @@ class AuthTest extends CakeTestCase {
$this->Controller->Auth->allowedActions = array('delete', 'add'); $this->Controller->Auth->allowedActions = array('delete', 'add');
$result = $this->Controller->Auth->startup($this->Controller); $result = $this->Controller->Auth->startup($this->Controller);
$this->assertFalse($result, 'startup() should return false, as action is not allowed. %s'); $this->assertFalse($result, 'startup() should return false, as action is not allowed. %s');
}
function testAllowedActionsSetWithAllowMethod() {
$url = '/auth_test/action_name';
$this->Controller->params = Router::parse($url);
$this->Controller->params['url']['url'] = Router::normalize($url);
$this->Controller->Auth->initialize($this->Controller);
$this->Controller->Auth->allow('action_name', 'anotherAction');
$this->assertEqual($this->Controller->Auth->allowedActions, array('action_name', 'anotheraction'));
} }
/** /**