Skip to content

Commit

Permalink
Update tests to ensure MailMessage implements the fluent interface pa…
Browse files Browse the repository at this point in the history
…ttern
  • Loading branch information
seriquynh committed Jul 1, 2024
1 parent 73f5e1b commit 295bd45
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions tests/Mail/MailMessageTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,65 +26,65 @@ protected function setUp(): void

public function testFromMethod()
{
$this->assertInstanceOf(Message::class, $message = $this->message->from('[email protected]', 'Foo'));
$this->assertEquals(new Address('[email protected]', 'Foo'), $message->getSymfonyMessage()->getFrom()[0]);
$this->assertSame($this->message, $this->message->from('[email protected]', 'Foo'));
$this->assertEquals(new Address('[email protected]', 'Foo'), $this->message->getSymfonyMessage()->getFrom()[0]);
}

public function testSenderMethod()
{
$this->assertInstanceOf(Message::class, $message = $this->message->sender('[email protected]', 'Foo'));
$this->assertEquals(new Address('[email protected]', 'Foo'), $message->getSymfonyMessage()->getSender());
$this->assertSame($this->message, $this->message->sender('[email protected]', 'Foo'));
$this->assertEquals(new Address('[email protected]', 'Foo'), $this->message->getSymfonyMessage()->getSender());
}

public function testReturnPathMethod()
{
$this->assertInstanceOf(Message::class, $message = $this->message->returnPath('[email protected]'));
$this->assertEquals(new Address('[email protected]'), $message->getSymfonyMessage()->getReturnPath());
$this->assertSame($this->message, $this->message->returnPath('[email protected]'));
$this->assertEquals(new Address('[email protected]'), $this->message->getSymfonyMessage()->getReturnPath());
}

public function testToMethod()
{
$this->assertInstanceOf(Message::class, $message = $this->message->to('[email protected]', 'Foo'));
$this->assertEquals(new Address('[email protected]', 'Foo'), $message->getSymfonyMessage()->getTo()[0]);
$this->assertSame($this->message, $this->message->to('[email protected]', 'Foo'));
$this->assertEquals(new Address('[email protected]', 'Foo'), $this->message->getSymfonyMessage()->getTo()[0]);

$this->assertInstanceOf(Message::class, $message = $this->message->to(['[email protected]' => 'Bar']));
$this->assertEquals(new Address('[email protected]', 'Bar'), $message->getSymfonyMessage()->getTo()[0]);
$this->assertSame($this->message, $this->message->to(['[email protected]' => 'Bar']));
$this->assertEquals(new Address('[email protected]', 'Bar'), $this->message->getSymfonyMessage()->getTo()[0]);
}

public function testToMethodWithOverride()
{
$this->assertInstanceOf(Message::class, $message = $this->message->to('[email protected]', 'Foo', true));
$this->assertEquals(new Address('[email protected]', 'Foo'), $message->getSymfonyMessage()->getTo()[0]);
$this->assertSame($this->message, $this->message->to('[email protected]', 'Foo', true));
$this->assertEquals(new Address('[email protected]', 'Foo'), $this->message->getSymfonyMessage()->getTo()[0]);
}

public function testCcMethod()
{
$this->assertInstanceOf(Message::class, $message = $this->message->cc('[email protected]', 'Foo'));
$this->assertEquals(new Address('[email protected]', 'Foo'), $message->getSymfonyMessage()->getCc()[0]);
$this->assertSame($this->message, $this->message->cc('[email protected]', 'Foo'));
$this->assertEquals(new Address('[email protected]', 'Foo'), $this->message->getSymfonyMessage()->getCc()[0]);
}

public function testBccMethod()
{
$this->assertInstanceOf(Message::class, $message = $this->message->bcc('[email protected]', 'Foo'));
$this->assertEquals(new Address('[email protected]', 'Foo'), $message->getSymfonyMessage()->getBcc()[0]);
$this->assertSame($this->message, $this->message->bcc('[email protected]', 'Foo'));
$this->assertEquals(new Address('[email protected]', 'Foo'), $this->message->getSymfonyMessage()->getBcc()[0]);
}

public function testReplyToMethod()
{
$this->assertInstanceOf(Message::class, $message = $this->message->replyTo('[email protected]', 'Foo'));
$this->assertEquals(new Address('[email protected]', 'Foo'), $message->getSymfonyMessage()->getReplyTo()[0]);
$this->assertSame($this->message, $this->message->replyTo('[email protected]', 'Foo'));
$this->assertEquals(new Address('[email protected]', 'Foo'), $this->message->getSymfonyMessage()->getReplyTo()[0]);
}

public function testSubjectMethod()
{
$this->assertInstanceOf(Message::class, $message = $this->message->subject('foo'));
$this->assertSame('foo', $message->getSymfonyMessage()->getSubject());
$this->assertSame($this->message, $this->message->subject('foo'));
$this->assertSame('foo', $this->message->getSymfonyMessage()->getSubject());
}

public function testPriorityMethod()
{
$this->assertInstanceOf(Message::class, $message = $this->message->priority(1));
$this->assertEquals(1, $message->getSymfonyMessage()->getPriority());
$this->assertSame($this->message, $this->message->priority(1));
$this->assertEquals(1, $this->message->getSymfonyMessage()->getPriority());
}

public function testBasicAttachment()
Expand Down

0 comments on commit 295bd45

Please sign in to comment.