mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Fixing failing tests caused by strtolower() in AuthComponent.
This commit is contained in:
parent
bc27d1eae4
commit
572f79be67
2 changed files with 8 additions and 10 deletions
|
@ -314,7 +314,7 @@ class AuthComponent extends Object {
|
||||||
}
|
}
|
||||||
|
|
||||||
$methods = array_flip($controller->methods);
|
$methods = array_flip($controller->methods);
|
||||||
$action = strtolower($controller->params['action']);
|
$action = $controller->params['action'];
|
||||||
$isMissingAction = (
|
$isMissingAction = (
|
||||||
$controller->scaffold === false &&
|
$controller->scaffold === false &&
|
||||||
!isset($methods[$action])
|
!isset($methods[$action])
|
||||||
|
@ -337,7 +337,7 @@ class AuthComponent extends Object {
|
||||||
$url = Router::normalize($url);
|
$url = Router::normalize($url);
|
||||||
$loginAction = Router::normalize($this->loginAction);
|
$loginAction = Router::normalize($this->loginAction);
|
||||||
|
|
||||||
$allowedActions = array_map('strtolower', $this->allowedActions);
|
$allowedActions = $this->allowedActions;
|
||||||
$isAllowed = (
|
$isAllowed = (
|
||||||
$this->allowedActions == array('*') ||
|
$this->allowedActions == array('*') ||
|
||||||
in_array($action, $allowedActions)
|
in_array($action, $allowedActions)
|
||||||
|
@ -612,7 +612,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('strtolower', $args));
|
$this->allowedActions = array_merge($this->allowedActions, $args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -632,7 +632,7 @@ class AuthComponent extends Object {
|
||||||
$args = $args[0];
|
$args = $args[0];
|
||||||
}
|
}
|
||||||
foreach ($args as $arg) {
|
foreach ($args as $arg) {
|
||||||
$i = array_search(strtolower($arg), $this->allowedActions);
|
$i = array_search($arg, $this->allowedActions);
|
||||||
if (is_int($i)) {
|
if (is_int($i)) {
|
||||||
unset($this->allowedActions[$i]);
|
unset($this->allowedActions[$i]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -825,7 +825,7 @@ class AuthTest extends CakeTestCase {
|
||||||
$this->Controller->Auth->initialize($this->Controller);
|
$this->Controller->Auth->initialize($this->Controller);
|
||||||
|
|
||||||
$this->Controller->Auth->allow('*');
|
$this->Controller->Auth->allow('*');
|
||||||
$this->Controller->Auth->deny('add', 'camelcase');
|
$this->Controller->Auth->deny('add', 'camelCase');
|
||||||
|
|
||||||
$this->Controller->params['action'] = 'delete';
|
$this->Controller->params['action'] = 'delete';
|
||||||
$this->assertTrue($this->Controller->Auth->startup($this->Controller));
|
$this->assertTrue($this->Controller->Auth->startup($this->Controller));
|
||||||
|
@ -833,14 +833,12 @@ class AuthTest extends CakeTestCase {
|
||||||
$this->Controller->params['action'] = 'add';
|
$this->Controller->params['action'] = 'add';
|
||||||
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
|
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
|
||||||
|
|
||||||
$this->Controller->params['action'] = 'Add';
|
|
||||||
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
|
|
||||||
|
|
||||||
$this->Controller->params['action'] = 'camelCase';
|
$this->Controller->params['action'] = 'camelCase';
|
||||||
|
|
||||||
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
|
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
|
||||||
|
|
||||||
$this->Controller->Auth->allow('*');
|
$this->Controller->Auth->allow('*');
|
||||||
$this->Controller->Auth->deny(array('add', 'camelcase'));
|
$this->Controller->Auth->deny(array('add', 'camelCase'));
|
||||||
|
|
||||||
$this->Controller->params['action'] = 'camelCase';
|
$this->Controller->params['action'] = 'camelCase';
|
||||||
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
|
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
|
||||||
|
@ -940,7 +938,7 @@ class AuthTest extends CakeTestCase {
|
||||||
$this->Controller->params['url']['url'] = Router::normalize($url);
|
$this->Controller->params['url']['url'] = Router::normalize($url);
|
||||||
$this->Controller->Auth->initialize($this->Controller);
|
$this->Controller->Auth->initialize($this->Controller);
|
||||||
$this->Controller->Auth->allow('action_name', 'anotherAction');
|
$this->Controller->Auth->allow('action_name', 'anotherAction');
|
||||||
$this->assertEqual($this->Controller->Auth->allowedActions, array('action_name', 'anotheraction'));
|
$this->assertEqual($this->Controller->Auth->allowedActions, array('action_name', 'anotherAction'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Add table
Reference in a new issue