Skip to content

Commit

Permalink
100 code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
Ivan Kerin committed Jul 31, 2013
1 parent ffc7698 commit 58c642d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 13 deletions.
14 changes: 2 additions & 12 deletions src/Openbuildings/Postmark/Postmark/Transport.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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');

}
}
14 changes: 13 additions & 1 deletion tests/tests/Postmark/TransportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ public function test_send()
->with($this->equalTo(array(
'From' => '[email protected]',
'To' => '[email protected]',
'Cc' => '[email protected],[email protected]',
'Bcc' => '[email protected],[email protected]',
'ReplyTo' => '[email protected]',
'Subject' => 'Test Big',
'TextBody' => 'Text Part',
'HtmlBody' => 'HTML Part',
Expand Down Expand Up @@ -71,12 +74,21 @@ public function test_send()
$message = Swift_Message::newInstance($transport);

$message->setFrom('[email protected]');
$message->setTo(array('[email protected]'));
$message->setTo('[email protected]');
$message->setReplyTo('[email protected]');
$message->setSubject('Test Big');
$message->setCc(array('[email protected]', '[email protected]'));
$message->setBcc(array('[email protected]', '[email protected]'));
$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'));
}
}

0 comments on commit 58c642d

Please sign in to comment.