Fixing failing tests caused by strtolower() in AuthComponent.

This commit is contained in:
mark_story 2010-07-10 12:00:09 -04:00
parent eeda60b89e
commit 5d2c48fd9c
2 changed files with 7 additions and 10 deletions

View file

@ -302,7 +302,7 @@ class AuthComponent extends Object {
}
$methods = array_flip($controller->methods);
$action = strtolower($controller->request->params['action']);
$action = $controller->request->params['action'];
$isMissingAction = (
$controller->scaffold === false &&
!isset($methods[$action])
@ -326,7 +326,7 @@ class AuthComponent extends Object {
$url = Router::normalize($url);
$loginAction = Router::normalize($this->loginAction);
$allowedActions = array_map('strtolower', $this->allowedActions);
$allowedActions = $this->allowedActions;
$isAllowed = (
$this->allowedActions == array('*') ||
in_array($action, $allowedActions)
@ -601,7 +601,7 @@ class AuthComponent extends Object {
if (isset($args[0]) && is_array($args[0])) {
$args = $args[0];
}
$this->allowedActions = array_merge($this->allowedActions, array_map('strtolower', $args));
$this->allowedActions = array_merge($this->allowedActions, $args);
}
}
@ -621,7 +621,7 @@ class AuthComponent extends Object {
$args = $args[0];
}
foreach ($args as $arg) {
$i = array_search(strtolower($arg), $this->allowedActions);
$i = array_search($arg, $this->allowedActions);
if (is_int($i)) {
unset($this->allowedActions[$i]);
}

View file

@ -833,7 +833,7 @@ class AuthTest extends CakeTestCase {
$this->Controller->Auth->initialize($this->Controller);
$this->Controller->Auth->allow('*');
$this->Controller->Auth->deny('add', 'camelcase');
$this->Controller->Auth->deny('add', 'camelCase');
$this->Controller->request['action'] = 'delete';
$this->assertTrue($this->Controller->Auth->startup($this->Controller));
@ -841,14 +841,11 @@ class AuthTest extends CakeTestCase {
$this->Controller->request['action'] = 'add';
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
$this->Controller->request['action'] = 'Add';
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
$this->Controller->request['action'] = 'camelCase';
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
$this->Controller->Auth->allow('*');
$this->Controller->Auth->deny(array('add', 'camelcase'));
$this->Controller->Auth->deny(array('add', 'camelCase'));
$this->Controller->request['action'] = 'camelCase';
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
@ -948,7 +945,7 @@ class AuthTest extends CakeTestCase {
$this->Controller->request->query['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'));
$this->assertEqual($this->Controller->Auth->allowedActions, array('action_name', 'anotherAction'));
}
/**