mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 11:28:25 +00:00
Fixing parameter ordering error of array_map in AuthComponent::allow(). Adding test.
This commit is contained in:
parent
42017e95c6
commit
2b0d13733e
2 changed files with 13 additions and 2 deletions
|
@ -600,7 +600,7 @@ class AuthComponent extends Object {
|
|||
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 @@ class AuthTest extends CakeTestCase {
|
|||
|
||||
$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 @@ class AuthTest extends CakeTestCase {
|
|||
$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'));
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue