This repository has been archived on 2023-08-20. You can view files and clone it, but cannot push or open issues or pull requests.
symfony/src/Symfony/Component/Mailer/Tests/SentMessageTest.php
2019-03-30 09:09:06 +01:00

37 lines
1.2 KiB
PHP

<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Symfony\Component\Mailer\Tests;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Mailer\SentMessage;
use Symfony\Component\Mailer\SmtpEnvelope;
use Symfony\Component\Mime\Address;
use Symfony\Component\Mime\Email;
use Symfony\Component\Mime\RawMessage;
class SentMessageTest extends TestCase
{
public function test()
{
$m = new SentMessage($r = new RawMessage('Email'), $e = new SmtpEnvelope(new Address('fabien@example.com'), [new Address('helene@example.com')]));
$this->assertSame($r, $m->getOriginalMessage());
$this->assertSame($r, $m->getMessage());
$this->assertSame($e, $m->getEnvelope());
$this->assertEquals($r->toString(), $m->toString());
$this->assertEquals($r->toIterable(), $m->toIterable());
$m = new SentMessage($r = (new Email())->from('fabien@example.com')->to('helene@example.com')->text('text'), $e);
$this->assertSame($r, $m->getOriginalMessage());
$this->assertNotSame($r, $m->getMessage());
}
}