File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change 33namespace Tests ;
44
55use Firebase \JWT \JWT ;
6+ use Firebase \JWT \SignatureInvalidException ;
67use Google \Cloud \Tasks \V2 \CloudTasksClient ;
7- use GuzzleHttp \Client ;
8- use Illuminate \Support \Facades \Cache ;
8+ use Illuminate \Cache \Events \CacheHit ;
9+ use Illuminate \Cache \Events \KeyWritten ;
10+ use Illuminate \Support \Facades \Event ;
911use Illuminate \Support \Facades \Mail ;
1012use Mockery ;
11- use phpseclib \Crypt \RSA ;
1213use Stackkit \LaravelGoogleCloudTasksQueue \CloudTasksException ;
1314use Stackkit \LaravelGoogleCloudTasksQueue \OpenIdVerificator ;
1415use Stackkit \LaravelGoogleCloudTasksQueue \TaskHandler ;
@@ -116,6 +117,21 @@ public function it_will_validate_the_token_expiration()
116117 $ this ->handler ->handle ($ this ->simpleJob ());
117118 }
118119
120+ /** @test */
121+ public function in_case_of_signature_verification_failure_it_will_retry ()
122+ {
123+ Event::fake ();
124+
125+ $ this ->jwt ->shouldReceive ('decode ' )->andThrow (SignatureInvalidException::class);
126+
127+ $ this ->expectException (SignatureInvalidException::class);
128+
129+ $ this ->handler ->handle ($ this ->simpleJob ());
130+
131+ Event::assertDispatched (CacheHit::class);
132+ Event::assertDispatched (KeyWritten::class);
133+ }
134+
119135 /** @test */
120136 public function it_runs_the_incoming_job ()
121137 {
You can’t perform that action at this time.
0 commit comments