Files
ppeasy_vg12/tests/Unit/Http/Middleware/SocialLoginTest.php
T
2026-10-09 08:21:06 +02:00

26 lines
822 B
PHP

<?php
use App\Http\Middleware\SocialLogin;
test('allows configured provider', function () {
config(['auth.social.providers' => ['github', 'google']]);
$response = $this->get('auth/github/login');
// Either the controller handles the request or another middleware
// intervenes — but the SocialLogin middleware itself should not 404.
$this->assertNotEquals(404, $response->getStatusCode());
});
test('middleware throws when provider not in config', function () {
config(['auth.social.providers' => ['github']]);
// Build a real route so $request->route()->parameter('provider') resolves.
Route::middleware(SocialLogin::class)
->get('/test-social/{provider}', fn ($provider) => 'ok');
$response = $this->get('/test-social/unknown');
$response->assertNotFound();
});