@@ -68,6 +68,22 @@ public function testRequest()
6868 $ this ->assertInstanceOf ('SparkPost\SparkPostPromise ' , $ this ->resource ->request ('GET ' , 'transmissions ' , $ this ->getTransmissionPayload ));
6969 }
7070
71+ public function testDebugOptionWhenFalse () {
72+ $ responseMock = Mockery::mock ('Psr\Http\Message\ResponseInterface ' );
73+ $ this ->resource ->setOptions (['async ' => false , 'debug ' => false ]);
74+ $ this ->clientMock ->shouldReceive ('sendRequest ' )->andReturn ($ responseMock );
75+ $ response = $ this ->resource ->request ('POST ' , 'transmissions ' , $ this ->postTransmissionPayload );
76+ $ this ->assertEquals ($ response ->getRequest (), null );
77+ }
78+
79+ public function testDebugOptionWhenTrue () {
80+ $ responseMock = Mockery::mock ('Psr\Http\Message\ResponseInterface ' );
81+ $ this ->resource ->setOptions (['async ' => false , 'debug ' => true ]);
82+ $ this ->clientMock ->shouldReceive ('sendRequest ' )->andReturn ($ responseMock );
83+ $ response = $ this ->resource ->request ('POST ' , 'transmissions ' , $ this ->postTransmissionPayload );
84+ $ this ->assertEquals (json_decode ($ response ->getRequest ()['body ' ], true ), $ this ->postTransmissionPayload );
85+ }
86+
7187 public function testSuccessfulSyncRequest ()
7288 {
7389 $ responseMock = Mockery::mock ('Psr\Http\Message\ResponseInterface ' );
@@ -194,7 +210,9 @@ public function testUnsuccessfulAsyncRequestWithThen()
194210
195211 $ guzzlePromise = new GuzzleRejectedPromise ($ exceptionMock );
196212
197- $ promise = new SparkPostPromise (new GuzzleAdapterPromise ($ guzzlePromise , $ this ->resource ->buildRequest ('POST ' , 'transmissions ' , $ this ->postTransmissionPayload , [])));
213+ $ request = $ this ->resource ->buildRequest ('POST ' , 'transmissions ' , $ this ->postTransmissionPayload , []);
214+
215+ $ promise = new SparkPostPromise (new GuzzleAdapterPromise ($ guzzlePromise , $ request ));
198216
199217 $ promise ->then (null , function ($ exception ) use ($ responseBody ) {
200218 $ this ->assertEquals (500 , $ exception ->getCode ());
0 commit comments