From 0828339a82c9636399fbe6bf2a45fa2bc4d489d2 Mon Sep 17 00:00:00 2001 From: Bobby Iliev Date: Sun, 1 Dec 2024 17:02:35 +0200 Subject: [PATCH] Fix failing tests --- config/devdojo/auth/language.php | 1 + resources/views/pages/auth/register.blade.php | 2 +- tests/Feature/RegistrationTest.php | 7 ++++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/config/devdojo/auth/language.php b/config/devdojo/auth/language.php index a20efaf..009ea36 100644 --- a/config/devdojo/auth/language.php +++ b/config/devdojo/auth/language.php @@ -33,6 +33,7 @@ 'already_have_an_account' => 'Already have an account?', 'sign_in' => 'Sign in', 'button' => 'Continue', + 'email_registration_disabled' => 'Email registration is currently disabled. Please use social login.', ], 'verify' => [ 'page_title' => 'Verify Your Account', diff --git a/resources/views/pages/auth/register.blade.php b/resources/views/pages/auth/register.blade.php index 7939916..f950023 100644 --- a/resources/views/pages/auth/register.blade.php +++ b/resources/views/pages/auth/register.blade.php @@ -94,7 +94,7 @@ public function register() if (!$this->settings->enable_email_registration) { session()->flash('error', config('devdojo.auth.language.register.email_registration_disabled', 'Email registration is currently disabled. Please use social login.')); - return; + return redirect()->route('auth.register'); } if (!$this->showPasswordField) { diff --git a/tests/Feature/RegistrationTest.php b/tests/Feature/RegistrationTest.php index 07a35ef..e216cc8 100644 --- a/tests/Feature/RegistrationTest.php +++ b/tests/Feature/RegistrationTest.php @@ -90,6 +90,11 @@ it('preserves social login functionality when email registration is disabled', function () { config()->set('devdojo.auth.settings.enable_email_registration', false); + config()->set('devdojo.auth.providers', [ + 'google' => ['name' => 'Google', 'active' => true], + 'facebook' => ['name' => 'Facebook', 'active' => false], + ]); + Livewire::test('auth.register') - ->assertSee('social-providers'); + ->assertSee('Google'); });