Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
CakeEmail::viewVars() now merge the param with previous config.
  • Loading branch information
jrbasso committed Apr 18, 2011
1 parent 7acdf1e commit 5ea3b75
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/Cake/Network/CakeEmail.php
Expand Up @@ -675,14 +675,14 @@ public function viewRender($viewClass = null) {
/**
* Variables to be set on render
*
* @param array
* @param array $viewVars
* @return mixed
*/
public function viewVars($viewVars = null) {
if ($viewVars === null) {
return $this->_viewVars;
}
$this->_viewVars = $viewVars;
$this->_viewVars = array_merge($this->_viewVars, (array)$viewVars);
return $this;
}

Expand Down
18 changes: 18 additions & 0 deletions lib/Cake/tests/Case/Network/CakeEmailTest.php
Expand Up @@ -431,6 +431,24 @@ public function testTemplate() {
$this->assertIdentical($this->CakeEmail->template(), $expected);
}

/**
* testViewVars method
*
* @return void
*/
public function testViewVars() {
$this->assertIdentical($this->CakeEmail->viewVars(), array());

$this->CakeEmail->viewVars(array('value' => 12345));
$this->assertIdentical($this->CakeEmail->viewVars(), array('value' => 12345));

$this->CakeEmail->viewVars(array('name' => 'CakePHP'));
$this->assertIdentical($this->CakeEmail->viewVars(), array('value' => 12345, 'name' => 'CakePHP'));

$this->CakeEmail->viewVars(array('value' => 4567));
$this->assertIdentical($this->CakeEmail->viewVars(), array('value' => 4567, 'name' => 'CakePHP'));
}

/**
* testAttachments method
*
Expand Down

0 comments on commit 5ea3b75

Please sign in to comment.