@@ -68,6 +68,22 @@ public function testRequest()
68
68
$ this ->assertInstanceOf ('SparkPost\SparkPostPromise ' , $ this ->resource ->request ('GET ' , 'transmissions ' , $ this ->getTransmissionPayload ));
69
69
}
70
70
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
+
71
87
public function testSuccessfulSyncRequest ()
72
88
{
73
89
$ responseMock = Mockery::mock ('Psr\Http\Message\ResponseInterface ' );
@@ -194,7 +210,9 @@ public function testUnsuccessfulAsyncRequestWithThen()
194
210
195
211
$ guzzlePromise = new GuzzleRejectedPromise ($ exceptionMock );
196
212
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 ));
198
216
199
217
$ promise ->then (null , function ($ exception ) use ($ responseBody ) {
200
218
$ this ->assertEquals (500 , $ exception ->getCode ());
0 commit comments