From 231da2563e9be66a1e0fff3336e19769fdce5694 Mon Sep 17 00:00:00 2001 From: Lupacescu Eduard Date: Sun, 10 May 2020 14:50:21 +0000 Subject: [PATCH] Apply fixes from StyleCI --- config/config.php | 2 +- src/Services/LoginService.php | 2 +- src/Services/RegisterService.php | 3 ++- src/Services/ResetPasswordService.php | 1 - tests/Feature/Authentication/AuthServiceForgotPasswordTest.php | 2 +- tests/Feature/Authentication/AuthServiceRegisterTest.php | 1 - tests/Fixtures/MailTracking.php | 1 - tests/Fixtures/User/User.php | 1 - 8 files changed, 5 insertions(+), 8 deletions(-) diff --git a/config/config.php b/config/config.php index f5e6762be..8c10001d1 100644 --- a/config/config.php +++ b/config/config.php @@ -42,7 +42,7 @@ 'frontend_app_url' => env('FRONTEND_APP_URL', env('APP_URL')), - 'password_reset_url' => env('FRONTEND_APP_URL') . '/password/reset?token={token}&email={email}', + 'password_reset_url' => env('FRONTEND_APP_URL').'/password/reset?token={token}&email={email}', ], /* diff --git a/src/Services/LoginService.php b/src/Services/LoginService.php index 60de0e8ff..909b77e18 100644 --- a/src/Services/LoginService.php +++ b/src/Services/LoginService.php @@ -34,6 +34,7 @@ public function login(Request $request) if ($this->attemptLogin($request)) { event(new UserLoggedIn($this->guard()->user())); + return $this->guard()->user()->createToken('login'); } @@ -43,6 +44,5 @@ public function login(Request $request) $this->incrementLoginAttempts($request); return $this->sendFailedLoginResponse($request); - } } diff --git a/src/Services/RegisterService.php b/src/Services/RegisterService.php index a91813095..1681c078a 100644 --- a/src/Services/RegisterService.php +++ b/src/Services/RegisterService.php @@ -86,7 +86,8 @@ public function validateRegister(array $payload) return true; } - protected function usingAuthService(AuthService $service) { + protected function usingAuthService(AuthService $service) + { $this->authService = $service; return $this; diff --git a/src/Services/ResetPasswordService.php b/src/Services/ResetPasswordService.php index a68dbffdc..3597fe379 100644 --- a/src/Services/ResetPasswordService.php +++ b/src/Services/ResetPasswordService.php @@ -20,7 +20,6 @@ public static function make(Request $request, AuthService $authService) ->reset($request); } - protected function usingAuthService(AuthService $authService) { $this->authService = $authService; diff --git a/tests/Feature/Authentication/AuthServiceForgotPasswordTest.php b/tests/Feature/Authentication/AuthServiceForgotPasswordTest.php index 1c1b6c55d..eabb4fb3a 100644 --- a/tests/Feature/Authentication/AuthServiceForgotPasswordTest.php +++ b/tests/Feature/Authentication/AuthServiceForgotPasswordTest.php @@ -3,7 +3,6 @@ namespace Binaryk\LaravelRestify\Tests\Feature\Authentication; use Binaryk\LaravelRestify\Events\UserLoggedIn; -use Binaryk\LaravelRestify\Notifications\PasswordResetNotification; use Binaryk\LaravelRestify\Services\AuthService; use Binaryk\LaravelRestify\Services\RegisterService; use Binaryk\LaravelRestify\Tests\Fixtures\MailTracking; @@ -55,6 +54,7 @@ public function test_email_was_sent_and_contain_token() Notification::assertSentTo($user, ResetPassword::class, function ($notification) { $this->assertNotEmpty($notification->token); + return true; }); } diff --git a/tests/Feature/Authentication/AuthServiceRegisterTest.php b/tests/Feature/Authentication/AuthServiceRegisterTest.php index 1c83363ef..68ac30108 100644 --- a/tests/Feature/Authentication/AuthServiceRegisterTest.php +++ b/tests/Feature/Authentication/AuthServiceRegisterTest.php @@ -52,7 +52,6 @@ public function test_register_throw_user_not_authenticatable() $request->merge($user); - $this->expectException(AuthenticatableUserException::class); $this->authService->register($request); } diff --git a/tests/Fixtures/MailTracking.php b/tests/Fixtures/MailTracking.php index c08b240cd..22e2dfc40 100644 --- a/tests/Fixtures/MailTracking.php +++ b/tests/Fixtures/MailTracking.php @@ -2,7 +2,6 @@ namespace Binaryk\LaravelRestify\Tests\Fixtures; -use Illuminate\Mail\Mailer; use Illuminate\Support\Facades\Mail; use Swift_Events_EventListener; use Swift_Message; diff --git a/tests/Fixtures/User/User.php b/tests/Fixtures/User/User.php index b54d37622..b072ec989 100644 --- a/tests/Fixtures/User/User.php +++ b/tests/Fixtures/User/User.php @@ -2,7 +2,6 @@ namespace Binaryk\LaravelRestify\Tests\Fixtures\User; -use Binaryk\LaravelRestify\Contracts\Passportable; use Binaryk\LaravelRestify\Contracts\RestifySearchable; use Binaryk\LaravelRestify\Contracts\Sanctumable; use Binaryk\LaravelRestify\Tests\Fixtures\Post\Post;