summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/unit/SendGridCompatibiility/EmailTest.php8
-rw-r--r--test/unit/TransmissionTest.php27
2 files changed, 31 insertions, 4 deletions
diff --git a/test/unit/SendGridCompatibiility/EmailTest.php b/test/unit/SendGridCompatibiility/EmailTest.php
index 26e5108..6679745 100644
--- a/test/unit/SendGridCompatibiility/EmailTest.php
+++ b/test/unit/SendGridCompatibiility/EmailTest.php
@@ -96,11 +96,13 @@ class SendGridCompatibilityEmailTest extends \PHPUnit_Framework_TestCase {
$this->assertEquals($value, $this->email->model['html']);
}
+ /**
+ * @desc test that adding a category throws an exception since we don't support tags at transmission level yet
+ * @expectedException Exception
+ * @expectedExceptionMessage Adding categories is not yet supported
+ */
public function testAddCategory() {
- $value = 'Category A';
$this->email->addCategory($value);
-
- $this->assertEquals(array($value), $this->email->model['tags']);
}
/**
diff --git a/test/unit/TransmissionTest.php b/test/unit/TransmissionTest.php
index cf4eda5..de72f2a 100644
--- a/test/unit/TransmissionTest.php
+++ b/test/unit/TransmissionTest.php
@@ -90,6 +90,18 @@ class TransmissionTest extends \PHPUnit_Framework_TestCase {
}
/**
+ * @desc tests bad response
+ * @expectedException Exception
+ * @expectedExceptionMessageRegExp /Unable to contact Transmissions API:.* /
+ */
+ public function testFindForCatchAllException() {
+ $mock = new MockPlugin();
+ $mock->addResponse(new Response(500));
+ $this->client->addSubscriber($mock);
+ Transmission::find('someId');
+ }
+
+ /**
* @desc tests happy path
*/
public function testSuccessfulSend() {
@@ -107,7 +119,7 @@ class TransmissionTest extends \PHPUnit_Framework_TestCase {
* @expectedException Exception
* @expectedExceptionMessage ["This is a fake error"]
*/
- public function testSendForRequestException() {
+ public function testSendFor400Exception() {
$body = array('errors'=>array('This is a fake error'));
$mock = new MockPlugin();
$mock->addResponse(new Response(400, array(), json_encode($body)));
@@ -115,5 +127,18 @@ class TransmissionTest extends \PHPUnit_Framework_TestCase {
Transmission::send(array('text'=>'awesome email'));
}
+
+ /**
+ * @desc tests bad response
+ * @expectedException Exception
+ * @expectedExceptionMessageRegExp /Unable to contact Transmissions API:.* /
+ */
+ public function testSendForCatchAllException() {
+ $mock = new MockPlugin();
+ $mock->addResponse(new Response(500));
+ $this->client->addSubscriber($mock);
+ Transmission::send(array('text'=>'awesome email'));
+ }
+
}
?> \ No newline at end of file