From 58c642d49a4ef2ea7b0de461bb1bd534a6391f8d Mon Sep 17 00:00:00 2001 From: Ivan Kerin Date: Wed, 31 Jul 2013 16:15:10 +0300 Subject: [PATCH] 100 code coverage --- src/Openbuildings/Postmark/Postmark/Transport.php | 14 ++------------ tests/tests/Postmark/TransportTest.php | 14 +++++++++++++- 2 files changed, 15 insertions(+), 13 deletions(-) diff --git a/src/Openbuildings/Postmark/Postmark/Transport.php b/src/Openbuildings/Postmark/Postmark/Transport.php index 3cede47..fb5cfb3 100644 --- a/src/Openbuildings/Postmark/Postmark/Transport.php +++ b/src/Openbuildings/Postmark/Postmark/Transport.php @@ -66,17 +66,6 @@ protected function getMIMEPart(\Swift_Mime_Message $message, $mime_type) return $part_content; } - /** - * @return array - */ - protected function headers() { - return array( - 'Accept: application/json', - 'Content-Type: application/json', - 'X-Postmark-Server-Token: ' . $this->postmark_api_token - ); - } - /** * @param Swift_Mime_Message $message * @param array $failed_recipients @@ -149,6 +138,7 @@ public function send(\Swift_Mime_Message $message, & $failed_recipients = NULL) public function registerPlugin(\Swift_Events_EventListener $plugin) { - // TODO + throw new \Exception('Postmark Transport does not support swiftmailer plugins'); + } } \ No newline at end of file diff --git a/tests/tests/Postmark/TransportTest.php b/tests/tests/Postmark/TransportTest.php index 071c3da..39a89cf 100644 --- a/tests/tests/Postmark/TransportTest.php +++ b/tests/tests/Postmark/TransportTest.php @@ -38,6 +38,9 @@ public function test_send() ->with($this->equalTo(array( 'From' => 'test12@example.com', 'To' => 'test13@example.com', + 'Cc' => 'test14@example.com,test15@example.com', + 'Bcc' => 'test16@example.com,test17@example.com', + 'ReplyTo' => 'test18@example.com', 'Subject' => 'Test Big', 'TextBody' => 'Text Part', 'HtmlBody' => 'HTML Part', @@ -71,12 +74,21 @@ public function test_send() $message = Swift_Message::newInstance($transport); $message->setFrom('test12@example.com'); - $message->setTo(array('test13@example.com')); + $message->setTo('test13@example.com'); + $message->setReplyTo('test18@example.com'); $message->setSubject('Test Big'); + $message->setCc(array('test14@example.com', 'test15@example.com')); + $message->setBcc(array('test16@example.com', 'test17@example.com')); $message->addPart('HTML Part', 'text/html'); $message->addPart('Text Part', 'text/plain'); $message->attach(Swift_Attachment::fromPath(__DIR__.'/../../test_data/logo_black.png')); $mailer->send($message); + + $transport->stop(); + + $this->setExpectedException('Exception'); + + $transport->registerPlugin($this->getMock('Swift_Events_EventListener')); } } \ No newline at end of file