Browse Source

Unit test for 'yii\swiftmailer\Message' serialization added.

tags/2.0.0-beta
Klimov Paul 11 years ago
parent
commit
c7e054789e
  1. 19
      tests/unit/extensions/swiftmailer/MessageTest.php

19
tests/unit/extensions/swiftmailer/MessageTest.php

@ -283,4 +283,23 @@ class MessageTest extends VendorTestCase
$this->assertTrue($textPresent, 'No text!'); $this->assertTrue($textPresent, 'No text!');
$this->assertTrue($htmlPresent, 'No HTML!'); $this->assertTrue($htmlPresent, 'No HTML!');
} }
/**
* @depends testGetSwiftMessage
*/
public function testSerialize()
{
$message = $this->createTestMessage();
$message->setTo($this->testEmailReceiver);
$message->setFrom('someuser@somedomain.com');
$message->setSubject('Yii Swift Alternative Body Test');
$message->setText('Yii Swift test plain text body');
$serializedMessage = serialize($message);
$this->assertNotEmpty($serializedMessage, 'Unable to serialize message!');
$unserializedMessaage = unserialize($serializedMessage);
$this->assertEquals($message, $unserializedMessaage, 'Unable to unserialize message!');
}
} }
Loading…
Cancel
Save