2026-03-19 10:47:39 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Tests\Controller;
|
|
|
|
|
|
|
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
|
|
|
|
|
|
|
|
class OAuthControllerTest extends WebTestCase
|
|
|
|
|
{
|
|
|
|
|
public function testSsoLoginRedirectsToKeycloak(): void
|
|
|
|
|
{
|
|
|
|
|
$client = static::createClient();
|
|
|
|
|
$client->request('GET', '/connection/sso/login');
|
|
|
|
|
|
|
|
|
|
self::assertResponseRedirects();
|
|
|
|
|
self::assertStringContainsString('auth.esy-web.dev', $client->getResponse()->headers->get('Location'));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function testSsoLogoutRedirectsToHome(): void
|
|
|
|
|
{
|
|
|
|
|
$client = static::createClient();
|
|
|
|
|
$client->request('GET', '/connection/sso/logout');
|
|
|
|
|
|
|
|
|
|
self::assertResponseRedirects('/');
|
|
|
|
|
}
|
2026-03-19 10:53:27 +01:00
|
|
|
|
|
|
|
|
public function testSsoCheckRedirectsToLogin(): void
|
|
|
|
|
{
|
|
|
|
|
$client = static::createClient();
|
|
|
|
|
$client->request('GET', '/connection/sso/check');
|
|
|
|
|
|
|
|
|
|
// Without OAuth token, the authenticator redirects to login
|
|
|
|
|
self::assertResponseRedirects();
|
|
|
|
|
}
|
2026-03-19 10:47:39 +01:00
|
|
|
}
|