Skip to content
Permalink
Browse files

Fixing failing tests caused by strtolower() in AuthComponent.

  • Loading branch information...
markstory committed Jul 10, 2010
1 parent bc27d1e commit 572f79be679c84266825a6b4deddd178d6b76ae8
@@ -314,7 +314,7 @@ public function startup(&$controller) {
}
$methods = array_flip($controller->methods);
$action = strtolower($controller->params['action']);
$action = $controller->params['action'];
$isMissingAction = (
$controller->scaffold === false &&
!isset($methods[$action])
@@ -337,7 +337,7 @@ public function startup(&$controller) {
$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)
@@ -612,7 +612,7 @@ public function allow() {
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);
}
}
@@ -632,7 +632,7 @@ public function deny() {
$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]);
}
@@ -825,22 +825,20 @@ function testAllowDenyAll() {
$this->Controller->Auth->initialize($this->Controller);
$this->Controller->Auth->allow('*');
$this->Controller->Auth->deny('add', 'camelcase');
$this->Controller->Auth->deny('add', 'camelCase');
$this->Controller->params['action'] = 'delete';
$this->assertTrue($this->Controller->Auth->startup($this->Controller));
$this->Controller->params['action'] = 'add';
$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->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->params['action'] = 'camelCase';
$this->assertFalse($this->Controller->Auth->startup($this->Controller));
@@ -940,7 +938,7 @@ function testAllowedActionsSetWithAllowMethod() {
$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'));
$this->assertEqual($this->Controller->Auth->allowedActions, array('action_name', 'anotherAction'));
}
/**

0 comments on commit 572f79b

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