55use Binaryk \LaravelRestify \Contracts \Passportable ;
66use Binaryk \LaravelRestify \Events \UserLoggedIn ;
77use Binaryk \LaravelRestify \Events \UserLogout ;
8+ use Binaryk \LaravelRestify \Exceptions \AirlockUserException ;
89use Binaryk \LaravelRestify \Exceptions \AuthenticatableUserException ;
910use Binaryk \LaravelRestify \Exceptions \CredentialsDoesntMatch ;
1011use Binaryk \LaravelRestify \Exceptions \PassportUserException ;
@@ -75,6 +76,7 @@ public function test_user_did_not_verified_email()
7576
7677 public function test_login_user_did_not_user_passport_trait_or_not_implement_pasportable ()
7778 {
79+ $ this ->app ['config ' ]->set ('restify.auth.provider ' , 'passport ' );
7880 $ this ->expectException (PassportUserException::class);
7981 $ userMustVerify = (new class extends User implements MustVerifyEmail {
8082 use \Illuminate \Auth \MustVerifyEmail;
@@ -94,6 +96,28 @@ public function test_login_user_did_not_user_passport_trait_or_not_implement_pas
9496 $ this ->authService ->login ();
9597 }
9698
99+ public function test_login_user_did_not_user_passport_trait_or_not_implement_airlockable ()
100+ {
101+ $ this ->app ['config ' ]->set ('restify.auth.provider ' , 'airlock ' );
102+ $ this ->expectException (AirlockUserException::class);
103+ $ userMustVerify = (new class extends User implements MustVerifyEmail {
104+ use \Illuminate \Auth \MustVerifyEmail;
105+ });
106+
107+ $ userMustVerify ->fill ([
108+ 109+ 'email_verified_at ' => Carbon::now (),
110+ ]);
111+
112+ Auth::shouldReceive ('attempt ' )
113+ ->andReturnTrue ();
114+
115+ Auth::shouldReceive ('user ' )
116+ ->andReturn ($ userMustVerify );
117+
118+ $ this ->authService ->login ();
119+ }
120+
97121 public function test_login_with_success ()
98122 {
99123 Event::fake ([
@@ -127,6 +151,8 @@ public function test_login_with_success()
127151 public function test_logout_success ()
128152 {
129153 Event::fake ();
154+ $ this ->app ['config ' ]->set ('restify.auth.provider ' , 'passport ' );
155+
130156 $ user = (new class extends \Binaryk \LaravelRestify \Tests \Fixtures \User {
131157 public function tokens ()
132158 {
0 commit comments