Skip to content
Permalink
Browse files

Removing variable name inflection from Controller::set()

  • Loading branch information...
nateabele committed Jan 20, 2009
1 parent 5a7dc39 commit c7d133fc0f5491debb70dcc87be39dd111687c5b
Showing with 3 additions and 7 deletions.
  1. +1 −5 cake/libs/controller/controller.php
  2. +2 −2 cake/tests/cases/libs/controller/controller.test.php
@@ -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;
}
}
}
@@ -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');
@@ -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');

0 comments on commit c7d133f

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