Removing variable name inflection from Controller::set()

This commit is contained in:
nate 2009-01-20 14:36:39 -05:00
parent 5a7dc398dd
commit c7d133fc0f
2 changed files with 3 additions and 7 deletions

View file

@ -640,15 +640,11 @@ class Controller extends Object {
foreach ($data as $name => $value) {
if ($name === 'title') {
$this->pageTitle = $value;
} else {
if ($two === null && is_array($one)) {
$this->viewVars[Inflector::variable($name)] = $value;
} else {
$this->viewVars[$name] = $value;
}
}
}
}
/**
* Internally redirects one action to another. Examples:
*

View file

@ -657,7 +657,7 @@ class ControllerTest extends CakeTestCase {
$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');
@ -666,7 +666,7 @@ class ControllerTest extends CakeTestCase {
$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');