Skip to content
Permalink
Browse files

Fixing parameter ordering error of array_map in AuthComponent::allow(…

…). Adding test.
  • Loading branch information...
jperras committed Sep 21, 2009
1 parent 42017e9 commit 2b0d13733edc09632e7075c243bca77331503583
@@ -600,7 +600,7 @@ function allow() {
if (isset($args[0]) && is_array($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));
}
}
@@ -844,7 +844,7 @@ function testActionMethod() {
$result = $this->Controller->Auth->action(':controller');
$this->assertEqual($result, 'ROOT/AuthTest');
$this->Controller->params['plugin'] = 'test_plugin';
$this->Controller->params['controller'] = 'auth_test';
$this->Controller->params['action'] = 'add';
@@ -899,6 +899,17 @@ function testAllowedActionsWithCamelCaseMethods() {
$this->Controller->Auth->allowedActions = array('delete', 'add');
$result = $this->Controller->Auth->startup($this->Controller);
$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'));
}
/**

0 comments on commit 2b0d137

Please sign in to comment.
You can’t perform that action at this time.