22
22
use GuzzleHttp \Middleware ;
23
23
use GuzzleHttp \Psr7 \Response ;
24
24
use Mockery as Mock ;
25
+ use CL \Slack \Exception \SlackException ;
25
26
26
27
/**
27
28
* @author Cas Leentfaar <[email protected] >
@@ -52,6 +53,7 @@ public function it_can_send_a_payload()
52
53
new Client (['handler ' => $ handler ])
53
54
);
54
55
56
+ $ eventsDispatched = [];
55
57
$ apiClient ->addRequestListener (function (RequestEvent $ event ) use (&$ eventsDispatched , $ mockRequestData , $ self ) {
56
58
$ eventsDispatched [ApiClient::EVENT_REQUEST ] = true ;
57
59
$ self ->assertEquals ($ mockRequestData , $ event ->getRawPayload ());
@@ -68,7 +70,7 @@ public function it_can_send_a_payload()
68
70
$ apiClient ->send ($ payload );
69
71
70
72
$ transaction = $ historyContainer [0 ];
71
- $ requestUrl = (string ) $ transaction ['request ' ]->getUri ();
73
+ $ requestUrl = (string )$ transaction ['request ' ]->getUri ();
72
74
$ requestContentType = $ transaction ['request ' ]->getHeader ('content-type ' )[0 ];
73
75
parse_str ($ transaction ['request ' ]->getBody (), $ requestBody );
74
76
$ responseBody = json_decode ($ transaction ['response ' ]->getBody (), true );
@@ -85,11 +87,11 @@ public function it_can_send_a_payload()
85
87
/**
86
88
* @test
87
89
*
88
- * @expectedException \CL\Slack\Exception\SlackException
89
- * @expectedExceptionMessage You must supply a token to send a payload, since you did not provide one during construction
90
90
*/
91
91
public function it_can_not_send_a_payload_without_a_token ()
92
92
{
93
+ $ this ->expectException (SlackException::class);
94
+ $ this ->expectExceptionMessage ("You must supply a token to send a payload, since you did not provide one during construction " );
93
95
/* @var PayloadInterface|Mock\MockInterface $mockPayload */
94
96
$ mockPayload = Mock::mock (PayloadInterface::class);
95
97
0 commit comments