<?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\Mime\Tests; use PHPUnit\Framework\TestCase; use Symfony\Component\Mime\DraftEmail; use Symfony\Component\Mime\Exception\LogicException; /** * @author Kevin Bond <kevinbond@gmail.com> */ final class DraftEmailTest extends TestCase { public function testCanHaveJustBody() { $email = (new DraftEmail())->text('some text')->toString(); $this->assertStringContainsString('some text', $email); $this->assertStringContainsString('MIME-Version: 1.0', $email); $this->assertStringContainsString('X-Unsent: 1', $email); } public function testBccIsRemoved() { $email = (new DraftEmail())->text('some text')->bcc('sam@example.com')->toString(); $this->assertStringNotContainsString('sam@example.com', $email); } public function testMustHaveBody() { $this->expectException(LogicException::class); (new DraftEmail())->toString(); } public function testEnsureValidityAlwaysFails() { $email = (new DraftEmail()) ->to('alice@example.com') ->from('webmaster@example.com') ->text('some text') ; $this->expectException(LogicException::class); $email->ensureValidity(); } }
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
Crypto | Folder | 0755 |
|
|
DependencyInjection | Folder | 0755 |
|
|
Encoder | Folder | 0755 |
|
|
Fixtures | Folder | 0755 |
|
|
Header | Folder | 0755 |
|
|
HtmlToTextConverter | Folder | 0755 |
|
|
Part | Folder | 0755 |
|
|
_data | Folder | 0755 |
|
|
AbstractMimeTypeGuesserTestCase.php | File | 4.15 KB | 0644 |
|
AddressTest.php | File | 4.92 KB | 0644 |
|
CharacterStreamTest.php | File | 3.33 KB | 0644 |
|
DraftEmailTest.php | File | 1.53 KB | 0644 |
|
EmailTest.php | File | 25.54 KB | 0644 |
|
FileBinaryMimeTypeGuesserTest.php | File | 753 B | 0644 |
|
FileinfoMimeTypeGuesserTest.php | File | 649 B | 0644 |
|
MessageConverterTest.php | File | 3.43 KB | 0644 |
|
MessageTest.php | File | 10.24 KB | 0644 |
|
MimeTypesTest.php | File | 2.92 KB | 0644 |
|
RawMessageTest.php | File | 1.89 KB | 0644 |
|