mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
CakeEmail::viewVars() now merge the param with previous config.
This commit is contained in:
parent
7acdf1e436
commit
5ea3b75b2f
2 changed files with 20 additions and 2 deletions
|
@ -675,14 +675,14 @@ class CakeEmail {
|
|||
/**
|
||||
* 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -431,6 +431,24 @@ class CakeEmailTest extends CakeTestCase {
|
|||
$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
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue