diff options
author | James Fellows <james.fellows@finanscapes.com> | 2016-04-04 23:20:07 +0100 |
---|---|---|
committer | James Fellows <james.fellows@finanscapes.com> | 2016-04-04 23:20:07 +0100 |
commit | 0a3035c4bd322a8c88313ab93deda0ac032e7f95 (patch) | |
tree | dfe41bc92649066fcc4dfe8f12421dab6a2bcac7 /test/unit/MessageEventTest.php | |
parent | 03c0f363fc17e555583b32b8a0ff7f73f9b46d20 (diff) | |
download | php-sparkpost-0a3035c4bd322a8c88313ab93deda0ac032e7f95.zip php-sparkpost-0a3035c4bd322a8c88313ab93deda0ac032e7f95.tar.gz php-sparkpost-0a3035c4bd322a8c88313ab93deda0ac032e7f95.tar.bz2 |
Add unit tests for Message Events::documentation and ::samples
Diffstat (limited to 'test/unit/MessageEventTest.php')
-rw-r--r-- | test/unit/MessageEventTest.php | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/test/unit/MessageEventTest.php b/test/unit/MessageEventTest.php index a91d17a..935939d 100644 --- a/test/unit/MessageEventTest.php +++ b/test/unit/MessageEventTest.php @@ -42,4 +42,30 @@ class MessageEventTest extends \PHPUnit_Framework_TestCase $this->assertEquals($testBody, $this->sut->search(["from" => $testFrom, "to" => $testTo])); } + + public function testDocumentation() { + $testBody = ['results' => ['my' => 'test']]; + $responseMock = Mockery::mock(); + $this->sparkPostMock->httpAdapter->shouldReceive('send')-> + once()-> + with("/message-events/events/documentation", 'GET', Mockery::type('array'), null)-> + andReturn($responseMock); + $responseMock->shouldReceive('getStatusCode')->andReturn(200); + $responseMock->shouldReceive('getBody->getContents')->andReturn(json_encode($testBody)); + + $this->assertEquals($testBody, $this->sut->documentation()); + } + + public function testSamples() { + $testBody = ['results' => ['my' => 'test']]; + $responseMock = Mockery::mock(); + $this->sparkPostMock->httpAdapter->shouldReceive('send')-> + once()-> + with("/message-events/events/samples?events=".urlencode("delivery,bounce"), 'GET', Mockery::type('array'), null)-> + andReturn($responseMock); + $responseMock->shouldReceive('getStatusCode')->andReturn(200); + $responseMock->shouldReceive('getBody->getContents')->andReturn(json_encode($testBody)); + + $this->assertEquals($testBody, $this->sut->samples(["delivery", "bounce"])); + } }
\ No newline at end of file |