Skip to content

Commit

Permalink
Removing variable name inflection from Controller::set()
Browse files Browse the repository at this point in the history
  • Loading branch information
nateabele committed Jan 20, 2009
1 parent 5a7dc39 commit c7d133f
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
6 changes: 1 addition & 5 deletions cake/libs/controller/controller.php
Expand Up @@ -641,11 +641,7 @@ function set($one, $two = null) {
if ($name === 'title') {
$this->pageTitle = $value;
} else {
if ($two === null && is_array($one)) {
$this->viewVars[Inflector::variable($name)] = $value;
} else {
$this->viewVars[$name] = $value;
}
$this->viewVars[$name] = $value;
}
}
}
Expand Down
4 changes: 2 additions & 2 deletions cake/tests/cases/libs/controller/controller.test.php
Expand Up @@ -657,7 +657,7 @@ function testControllerSet() {
$Controller->viewVars = array();
$viewVars = array('ModelName' => array('id' => 1, 'name' => 'value'));
$Controller->set($viewVars);
$this->assertTrue(array_key_exists('modelName', $Controller->viewVars));
$this->assertTrue(array_key_exists('ModelName', $Controller->viewVars));

$Controller->viewVars = array();
$Controller->set('variable_with_underscores', 'value');
Expand All @@ -666,7 +666,7 @@ function testControllerSet() {
$Controller->viewVars = array();
$viewVars = array('ModelName' => 'name');
$Controller->set($viewVars);
$this->assertTrue(array_key_exists('modelName', $Controller->viewVars));
$this->assertTrue(array_key_exists('ModelName', $Controller->viewVars));

$Controller->set('title', 'someTitle');
$this->assertIdentical($Controller->pageTitle, 'someTitle');
Expand Down

0 comments on commit c7d133f

Please sign in to comment.