13
13
use SoapBox \SignedRequests \Requests \Payload ;
14
14
use Illuminate \Contracts \Cache \Repository as Cache ;
15
15
use Illuminate \Contracts \Config \Repository as Configurations ;
16
+ use SoapBox \SignedRequests \Exceptions \ExpiredRequestException ;
17
+ use SoapBox \SignedRequests \Exceptions \InvalidConfigurationException ;
18
+ use SoapBox \SignedRequests \Exceptions \InvalidSignatureException ;
16
19
use SoapBox \SignedRequests \Middlewares \Laravel \VerifySignature ;
17
20
18
21
class VerifySignatureTest extends TestCase
@@ -70,10 +73,11 @@ public function it_can_be_constructed()
70
73
71
74
/**
72
75
* @test
73
- * @expectedException \SoapBox\SignedRequests\Exceptions\InvalidSignatureException
74
76
*/
75
77
public function it_throws_an_invalid_signature_exception_if_the_request_is_not_valid ()
76
78
{
79
+ $ this ->expectException (InvalidSignatureException::class);
80
+
77
81
$ this ->configurations ->shouldReceive ('get ' )
78
82
->with ('signed-requests.default.headers.signature ' )
79
83
->andReturn ('HTTP_SIGNATURE ' );
@@ -190,10 +194,11 @@ public function it_should_set_the_key_when_one_is_passed()
190
194
191
195
/**
192
196
* @test
193
- * @expectedException \SoapBox\SignedRequests\Exceptions\InvalidConfigurationException
194
197
*/
195
198
public function it_should_throw_an_exception_when_it_cannot_find_the_key ()
196
199
{
200
+ $ this ->expectException (InvalidConfigurationException::class);
201
+
197
202
$ id = (string ) Uuid::uuid4 ();
198
203
199
204
$ query = [];
@@ -217,10 +222,11 @@ public function it_should_throw_an_exception_when_it_cannot_find_the_key()
217
222
218
223
/**
219
224
* @test
220
- * @expectedException \SoapBox\SignedRequests\Exceptions\ExpiredRequestException
221
225
*/
222
226
public function it_throws_an_expired_request_exception_if_the_timestamp_on_the_request_is_outside_of_the_tolerance_allowed_for_requests ()
223
227
{
228
+ $ this ->expectException (ExpiredRequestException::class);
229
+
224
230
$ id = (string ) Uuid::uuid4 ();
225
231
226
232
$ this ->configurations ->shouldReceive ('get ' )
@@ -302,10 +308,11 @@ public function it_should_call_our_callback_if_the_id_has_not_previously_been_se
302
308
303
309
/**
304
310
* @test
305
- * @expectedException \SoapBox\SignedRequests\Exceptions\ExpiredRequestException
306
311
*/
307
312
public function it_should_throw_an_expired_request_exception_if_the_request_id_has_previously_been_seen ()
308
313
{
314
+ $ this ->expectException (ExpiredRequestException::class);
315
+
309
316
$ id = (string ) Uuid::uuid4 ();
310
317
311
318
$ this ->configurations ->shouldReceive ('get ' )
@@ -348,10 +355,11 @@ public function it_should_throw_an_expired_request_exception_if_the_request_id_h
348
355
349
356
/**
350
357
* @test
351
- * @expectedException \SoapBox\SignedRequests\Exceptions\ExpiredRequestException
352
358
*/
353
359
public function it_should_throw_an_expired_request_exception_if_the_same_request_is_played_multiple_times ()
354
360
{
361
+ $ this ->expectException (ExpiredRequestException::class);
362
+
355
363
$ id = (string ) Uuid::uuid4 ();
356
364
357
365
$ this ->configurations ->shouldReceive ('get ' )
@@ -395,10 +403,11 @@ public function it_should_throw_an_expired_request_exception_if_the_same_request
395
403
396
404
/**
397
405
* @test
398
- * @expectedException \SoapBox\SignedRequests\Exceptions\ExpiredRequestException
399
406
*/
400
407
public function it_throws_an_expired_request_exception_if_the_timestamp_on_the_request_does_not_have_the_correct_format ()
401
408
{
409
+ $ this ->expectException (ExpiredRequestException::class);
410
+
402
411
$ id = (string ) Uuid::uuid4 ();
403
412
404
413
$ this ->configurations ->shouldReceive ('get ' )
0 commit comments