mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2025-01-19 02:56:15 +00:00
Methods to set/get subject.
This commit is contained in:
parent
187304cebb
commit
82835a3566
2 changed files with 36 additions and 1 deletions
|
@ -97,7 +97,7 @@ class CakeEmail {
|
|||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_subject = null;
|
||||
protected $_subject = '';
|
||||
|
||||
/**
|
||||
* Associative array of a user defined headers
|
||||
|
@ -451,6 +451,25 @@ class CakeEmail {
|
|||
$this->{$varName} = array_merge($this->{$varName}, $list);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Subject
|
||||
*
|
||||
* @param string $subject
|
||||
* @return void
|
||||
*/
|
||||
public function setSubject($subject) {
|
||||
$this->_subject = (string)$subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Subject
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSubject() {
|
||||
return $this->_subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets headers for the message
|
||||
*
|
||||
|
|
|
@ -102,6 +102,22 @@ class CakeEmailTest extends CakeTestCase {
|
|||
$this->assertIdentical($this->CakeEmail->getTo(), $expected);
|
||||
}
|
||||
|
||||
/**
|
||||
* testSubject method
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testSubject() {
|
||||
$this->CakeEmail->setSubject('You have a new message.');
|
||||
$this->assertIdentical($this->CakeEmail->getSubject(), 'You have a new message.');
|
||||
|
||||
$this->CakeEmail->setSubject(1);
|
||||
$this->assertIdentical($this->CakeEmail->getSubject(), '1');
|
||||
|
||||
$this->CakeEmail->setSubject(array('something'));
|
||||
$this->assertIdentical($this->CakeEmail->getSubject(), 'Array');
|
||||
}
|
||||
|
||||
/**
|
||||
* testHeaders method
|
||||
*
|
||||
|
|
Loading…
Add table
Reference in a new issue