pull/7309/head
Your Name 1 week ago
parent afe2bb6d1d
commit b716a5aa5d

@ -32,7 +32,7 @@ class CaptchaAdminSettingsTest extends TestCase
$this->assertSame('turnstile', $platform['captcha_driver']);
$this->assertTrue($platform['captcha_on_login']);
$this->assertFalse($platform['captcha_on_register']);
$this->assertTrue($platform['captcha_on_forgotpassword']);
$this->assertTrue($platform['captcha_on_forgot_password']);
$this->assertFalse($platform['captcha_on_password_reset']);
$this->assertTrue($platform['captcha_on_forgot_email']);
$this->assertTrue($platform['captcha_on_curated_register']);

@ -5,7 +5,9 @@ namespace Tests\Feature;
use App\Models\User;
use Illuminate\Foundation\Testing\LazilyRefreshDatabase;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Mail;
use PHPUnit\Framework\Attributes\Test;
use Spatie\Honeypot\ProtectAgainstSpam;
use Tests\TestCase;
/**
@ -144,7 +146,7 @@ class CaptchaEnforcementTest extends TestCase
'captcha.active.register' => true,
'pixelfed.open_registration' => true,
]);
$this->withoutMiddleware(\Spatie\Honeypot\ProtectAgainstSpam::class);
$this->withoutMiddleware(ProtectAgainstSpam::class);
$response = $this->postJson('/register', [
'agecheck' => '1',
@ -166,7 +168,7 @@ class CaptchaEnforcementTest extends TestCase
'pixelfed.open_registration' => true,
]);
$this->fakeCaptchaSuccess();
$this->withoutMiddleware(\Spatie\Honeypot\ProtectAgainstSpam::class);
$this->withoutMiddleware(ProtectAgainstSpam::class);
$response = $this->postJson('/register', [
'agecheck' => '1',
@ -182,13 +184,13 @@ class CaptchaEnforcementTest extends TestCase
}
// ---------------------------------------------------------------------
// Forgot password (send reset link) — surface: forgotpassword
// Forgot password (send reset link) — surface: forgot_password
// ---------------------------------------------------------------------
#[Test]
public function forgot_password_is_blocked_when_captcha_token_is_missing(): void
{
config(['captcha.active.forgotpassword' => true]);
config(['captcha.active.forgot_password' => true]);
$response = $this->postJson('/password/email', [
'email' => 'someone@example.com',
@ -201,7 +203,7 @@ class CaptchaEnforcementTest extends TestCase
#[Test]
public function forgot_password_passes_captcha_with_a_valid_token(): void
{
config(['captcha.active.forgotpassword' => true]);
config(['captcha.active.forgot_password' => true]);
$this->fakeCaptchaSuccess();
$response = $this->postJson('/password/email', [
@ -261,7 +263,7 @@ class CaptchaEnforcementTest extends TestCase
'security.forgot-email.enabled' => true,
]);
$this->fakeCaptchaSuccess();
\Illuminate\Support\Facades\Mail::fake();
Mail::fake();
$user = User::factory()->create();
// Success path redirects (not JSON); assert the captcha cleared, i.e. the

@ -136,7 +136,7 @@ class CaptchaManagerTest extends TestCase
'captcha.enabled' => true,
'captcha.active.login' => true,
'captcha.active.register' => false,
'captcha.active.forgotpassword' => true,
'captcha.active.forgot_password' => true,
'captcha.active.password_reset' => false,
'captcha.active.forgot_email' => true,
'captcha.active.curated_register' => true,

Loading…
Cancel
Save