Skip to content

Commit

Permalink
Remove duplicate property names & fix tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Feb 22, 2013
1 parent 41cd758 commit e69a549
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 22 deletions.
7 changes: 0 additions & 7 deletions lib/Cake/Controller/Controller.php
Expand Up @@ -147,13 +147,6 @@ class Controller extends Object implements EventListener {
*/
public $layoutPath = null;

/**
* Contains variables to be handed to the view.
*
* @var array
*/
public $viewVars = array();

/**
* The name of the view file to render. The name specified
* is the filename in /app/View/<SubFolder> without the .ctp extension.
Expand Down
16 changes: 8 additions & 8 deletions lib/Cake/Test/TestCase/Console/Command/Task/TemplateTaskTest.php
Expand Up @@ -65,20 +65,20 @@ public function tearDown() {
*/
public function testSet() {
$this->Task->set('one', 'two');
$this->assertTrue(isset($this->Task->templateVars['one']));
$this->assertEquals('two', $this->Task->templateVars['one']);
$this->assertTrue(isset($this->Task->viewVars['one']));
$this->assertEquals('two', $this->Task->viewVars['one']);

$this->Task->set(array('one' => 'three', 'four' => 'five'));
$this->assertTrue(isset($this->Task->templateVars['one']));
$this->assertEquals('three', $this->Task->templateVars['one']);
$this->assertTrue(isset($this->Task->templateVars['four']));
$this->assertEquals('five', $this->Task->templateVars['four']);
$this->assertTrue(isset($this->Task->viewVars['one']));
$this->assertEquals('three', $this->Task->viewVars['one']);
$this->assertTrue(isset($this->Task->viewVars['four']));
$this->assertEquals('five', $this->Task->viewVars['four']);

$this->Task->templateVars = array();
$this->Task->viewVars = array();
$this->Task->set(array(3 => 'three', 4 => 'four'));
$this->Task->set(array(1 => 'one', 2 => 'two'));
$expected = array(3 => 'three', 4 => 'four', 1 => 'one', 2 => 'two');
$this->assertEquals($expected, $this->Task->templateVars);
$this->assertEquals($expected, $this->Task->viewVars);
}

/**
Expand Down
5 changes: 5 additions & 0 deletions lib/Cake/Utility/ViewVarsTrait.php
Expand Up @@ -23,6 +23,11 @@
*/
trait ViewVarsTrait {

/**
* Variables for the view
*
* @var array
*/
public $viewVars = array();

/**
Expand Down
7 changes: 0 additions & 7 deletions lib/Cake/View/View.php
Expand Up @@ -119,13 +119,6 @@ class View extends Object {
*/
public $viewPath = null;

/**
* Variables for the view
*
* @var array
*/
public $viewVars = array();

/**
* Name of view to use with this View.
*
Expand Down

0 comments on commit e69a549

Please sign in to comment.