diff options
author | Avi Goldman <avrahamymgoldman@gmail.com> | 2016-06-20 11:26:43 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-06-20 11:26:43 -0400 |
commit | 87552cc2766f4ea8c8a2d6ff6c70dd74faecb687 (patch) | |
tree | 0d37219ce699bffd8adc0cd5fb7c5ec012c80df0 /test/unit/MessageEventTest.php | |
parent | a5847be109dc6350fb0bc8beb8d0ba8bc23b75b6 (diff) | |
download | php-sparkpost-87552cc2766f4ea8c8a2d6ff6c70dd74faecb687.zip php-sparkpost-87552cc2766f4ea8c8a2d6ff6c70dd74faecb687.tar.gz php-sparkpost-87552cc2766f4ea8c8a2d6ff6c70dd74faecb687.tar.bz2 |
Merged FAD-3148 into 2.x
* FAD-3148 basic non-functioning base class
* FAD-3148 a bit more functionality in the base class
* FAD-3148 added custom promise class and custom response class. Did good things to SparkPost class
* Updated Transmission.php for new refactor, still WIP. Created Resource.php as a parent class for all future resources.
* Removed test functions
* Cleaned up Transmissions.php according to PSR-2, deleted more test code and comments.
* added sync and aysnc, cleaned up code
* added support for async/sync option
* added support for async/sync option
* Added interns to authors
* simplified the request function
* added comments
* added user agent
* added comments in SparkPostPromise
* added comments in SparkPostException
* added comments in SparkPostResponse
* cleaning up test
* updated composer.json and contributing files for testing
* Ran php-cs-fixer
* testing for sparkpost response class
* updated to newer version of guzzle
* updated to newer version of guzzle
* Cleaned up getUrl and other functions
* cleaned up constructor and overrode getCode with getResponse()->getStatusCode()
* fixed up then method
* cleaned up getBody
* deleted old test
* Wrote total coverage tests for SparkPost class
* commented out setting up transmissions endpoint until merging with FAD-3146
Diffstat (limited to 'test/unit/MessageEventTest.php')
-rw-r--r-- | test/unit/MessageEventTest.php | 74 |
1 files changed, 0 insertions, 74 deletions
diff --git a/test/unit/MessageEventTest.php b/test/unit/MessageEventTest.php deleted file mode 100644 index 3d92412..0000000 --- a/test/unit/MessageEventTest.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php - -namespace SparkPost; - -use Mockery; - -class MessageEventTest extends \PHPUnit_Framework_TestCase -{ - private $sparkPostMock; - private $sut; - - /** - * (non-PHPdoc). - * - * @before - * - * @see PHPUnit_Framework_TestCase::setUp() - */ - public function setUp() - { - $this->sparkPostMock = Mockery::mock('SparkPost\SparkPost', function ($mock) { - $mock->shouldReceive('getHttpHeaders')->andReturn([]); - }); - $this->sparkPostMock->httpAdapter = Mockery::mock(); - $this->sut = new MessageEvents($this->sparkPostMock); - } - - public function testDateTimeConversion() - { - $testBody = ['results' => ['my' => 'test']]; - $testFrom = new \DateTime('1978-08-27 04:05:02'); - $testFromStr = urlencode('1978-08-27T04:05'); - $testTo = new \DateTime('2016-04-04 19:00'); - $testToStr = urlencode('2016-04-04T19:00'); - - $responseMock = Mockery::mock(); - $this->sparkPostMock->httpAdapter->shouldReceive('send')-> - once()-> - with("/message-events/?from={$testFromStr}&to={$testToStr}", '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->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'])); - } -} |