1313class AuthTest extends AuthTestCase
1414{
1515 private JwtToken $ jwt ;
16+ private Hasher $ hasher ;
1617
1718 public function setUp (): void
1819 {
1920 parent ::setUp ();
2021
22+ $ this ->hasher = (new Hasher ())->setCost (4 );
23+
2124 $ this ->jwt = (new JwtToken ())
2225 ->setLeeway (1 )
2326 ->setClaims ([
@@ -32,18 +35,18 @@ public function setUp(): void
3235
3336 public function testAuthGetAdapter (): void
3437 {
35- $ auth = new Auth (new SessionAuthAdapter ($ this ->authService , $ this ->mailer , new Hasher () ));
38+ $ auth = new Auth (new SessionAuthAdapter ($ this ->authService , $ this ->mailer , $ this -> hasher ));
3639
3740 $ this ->assertInstanceOf (AuthenticatableInterface::class, $ auth ->getAdapter ());
3841
39- $ auth = new Auth (new JwtAuthAdapter ($ this ->authService , $ this ->mailer , new Hasher () , $ this ->jwt ));
42+ $ auth = new Auth (new JwtAuthAdapter ($ this ->authService , $ this ->mailer , $ this -> hasher , $ this ->jwt ));
4043
4144 $ this ->assertInstanceOf (AuthenticatableInterface::class, $ auth ->getAdapter ());
4245 }
4346
4447 public function testAuthCallingValidMethod (): void
4548 {
46- $ auth = new Auth (new JwtAuthAdapter ($ this ->authService , $ this ->mailer , new Hasher () , $ this ->jwt ));
49+ $ auth = new Auth (new JwtAuthAdapter ($ this ->authService , $ this ->mailer , $ this -> hasher , $ this ->jwt ));
4750
4851 $ user = $ auth ->getAdapter ()->signup ($ this ->adminUser );
4952
@@ -58,7 +61,7 @@ public function testAuthCallingValidMethod(): void
5861
5962 public function testAuthCallingInvalidMethod (): void
6063 {
61- $ auth = new Auth (new JwtAuthAdapter ($ this ->authService , $ this ->mailer , new Hasher () , $ this ->jwt ));
64+ $ auth = new Auth (new JwtAuthAdapter ($ this ->authService , $ this ->mailer , $ this -> hasher , $ this ->jwt ));
6265
6366 $ this ->expectException (AuthException::class);
6467
0 commit comments