Skip to content

Commit 7da8272

Browse files
committed
add test from laravel 9.x
1 parent 98df200 commit 7da8272

1 file changed

Lines changed: 57 additions & 0 deletions

File tree

tests/Mail/MailMessageTest.php

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
use Illuminate\Mail\Message;
44
use L4\Tests\BackwardCompatibleTestCase;
55
use Mockery as m;
6+
use Symfony\Component\Mime\Address;
67
use Symfony\Component\Mime\Email;
78

89
class MailMessageTest extends BackwardCompatibleTestCase
@@ -34,6 +35,62 @@ protected function tearDown(): void
3435
m::close();
3536
}
3637

38+
public function testFromMethod()
39+
{
40+
self::assertInstanceOf(Message::class, $message = $this->message->from('foo@bar.baz', 'Foo'));
41+
self::assertEquals(new Address('foo@bar.baz', 'Foo'), $message->getSymfonyMessage()->getFrom()[0]);
42+
}
43+
44+
public function testSenderMethod()
45+
{
46+
self::assertInstanceOf(Message::class, $message = $this->message->sender('foo@bar.baz', 'Foo'));
47+
self::assertEquals(new Address('foo@bar.baz', 'Foo'), $message->getSymfonyMessage()->getSender());
48+
}
49+
50+
public function testReturnPathMethod()
51+
{
52+
self::assertInstanceOf(Message::class, $message = $this->message->returnPath('foo@bar.baz'));
53+
self::assertEquals(new Address('foo@bar.baz'), $message->getSymfonyMessage()->getReturnPath());
54+
}
55+
56+
public function testToMethod()
57+
{
58+
self::assertInstanceOf(Message::class, $message = $this->message->to('foo@bar.baz', 'Foo'));
59+
self::assertEquals(new Address('foo@bar.baz', 'Foo'), $message->getSymfonyMessage()->getTo()[0]);
60+
61+
self::assertInstanceOf(Message::class, $message = $this->message->to(['bar@bar.baz' => 'Bar']));
62+
self::assertEquals(new Address('bar@bar.baz', 'Bar'), $message->getSymfonyMessage()->getTo()[0]);
63+
}
64+
65+
public function testCcMethod()
66+
{
67+
self::assertInstanceOf(Message::class, $message = $this->message->cc('foo@bar.baz', 'Foo'));
68+
self::assertEquals(new Address('foo@bar.baz', 'Foo'), $message->getSymfonyMessage()->getCc()[0]);
69+
}
70+
71+
public function testBccMethod()
72+
{
73+
self::assertInstanceOf(Message::class, $message = $this->message->bcc('foo@bar.baz', 'Foo'));
74+
self::assertEquals(new Address('foo@bar.baz', 'Foo'), $message->getSymfonyMessage()->getBcc()[0]);
75+
}
76+
77+
public function testReplyToMethod()
78+
{
79+
self::assertInstanceOf(Message::class, $message = $this->message->replyTo('foo@bar.baz', 'Foo'));
80+
self::assertEquals(new Address('foo@bar.baz', 'Foo'), $message->getSymfonyMessage()->getReplyTo()[0]);
81+
}
82+
83+
public function testSubjectMethod()
84+
{
85+
self::assertInstanceOf(Message::class, $message = $this->message->subject('foo'));
86+
self::assertSame('foo', $message->getSymfonyMessage()->getSubject());
87+
}
88+
89+
public function testPriorityMethod()
90+
{
91+
self::assertInstanceOf(Message::class, $message = $this->message->priority(1));
92+
self::assertEquals(1, $message->getSymfonyMessage()->getPriority());
93+
}
3794

3895
public function testBasicAttachment(): void
3996
{

0 commit comments

Comments
 (0)