Files
e-ticket/tests/Controller/OAuthControllerTest.php

35 lines
967 B
PHP
Raw Permalink Normal View History

<?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('/');
}
public function testSsoCheckRedirectsToLogin(): void
{
$client = static::createClient();
$client->request('GET', '/connection/sso/check');
// Without OAuth token, the authenticator redirects to login
self::assertResponseRedirects();
}
}