mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Removing variable name inflection from Controller::set()
This commit is contained in:
parent
5a7dc398dd
commit
c7d133fc0f
2 changed files with 3 additions and 7 deletions
|
@ -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:
|
||||
*
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in a new issue