summaryrefslogtreecommitdiffstats
path: root/test/unit/TransmissionTest.php
diff options
context:
space:
mode:
authorAvi Goldman <avrahamymgoldman@gmail.com>2016-08-25 11:52:44 -0400
committerGitHub <noreply@github.com>2016-08-25 11:52:44 -0400
commit1bbefef4df13778b5924e959047124f075ac38e6 (patch)
treedaba6298beb07c0ef4bbdb2dfd135ec2ddfb8df5 /test/unit/TransmissionTest.php
parente325c046ac4d3478b1f5b70085162e9f932e071b (diff)
downloadphp-sparkpost-1bbefef4df13778b5924e959047124f075ac38e6.zip
php-sparkpost-1bbefef4df13778b5924e959047124f075ac38e6.tar.gz
php-sparkpost-1bbefef4df13778b5924e959047124f075ac38e6.tar.bz2
Updating examples (#139)
* added example of getting transmission by ID * updated example messages and added example with recipient list and template * fixed lib to work with recipient lists * fixed lib to work with recipient lists * added test covering recipient list * added message event example * added template examples
Diffstat (limited to 'test/unit/TransmissionTest.php')
-rw-r--r--test/unit/TransmissionTest.php25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/unit/TransmissionTest.php b/test/unit/TransmissionTest.php
index 5af876e..c956c12 100644
--- a/test/unit/TransmissionTest.php
+++ b/test/unit/TransmissionTest.php
@@ -145,6 +145,31 @@ class TransmissionTest extends \PHPUnit_Framework_TestCase
$this->assertEquals(200, $response->getStatusCode());
}
+ public function testPostWithRecipientList()
+ {
+ $postTransmissionPayload = $this->postTransmissionPayload;
+ $postTransmissionPayload['recipients'] = ['list_id' => 'SOME_LIST_ID'];
+
+ $responseMock = Mockery::mock('Psr\Http\Message\ResponseInterface');
+ $responseBodyMock = Mockery::mock();
+
+ $responseBody = ['results' => 'yay'];
+
+ $this->clientMock->shouldReceive('sendRequest')->
+ once()->
+ with(Mockery::type('GuzzleHttp\Psr7\Request'))->
+ andReturn($responseMock);
+
+ $responseMock->shouldReceive('getStatusCode')->andReturn(200);
+ $responseMock->shouldReceive('getBody')->andReturn($responseBodyMock);
+ $responseBodyMock->shouldReceive('__toString')->andReturn(json_encode($responseBody));
+
+ $response = $this->resource->transmissions->post();
+
+ $this->assertEquals($responseBody, $response->getBody());
+ $this->assertEquals(200, $response->getStatusCode());
+ }
+
public function testDelete()
{
$responseMock = Mockery::mock('Psr\Http\Message\ResponseInterface');