Files
archived-ux.symfony.com/tests/Functional/RedirectUrlTest.php
Hugo Alliaume 1d73c40173 Add PHPStan
2026-01-24 09:09:38 +01:00

48 lines
1.8 KiB
PHP

<?php
/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace App\Tests\Functional;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
class RedirectUrlTest extends WebTestCase
{
/**
* @dataProvider getRedirectionTests
*/
public function testUrlRedirections(string $url, string $expectedUrl, int $expectedStatusCode)
{
$client = self::createClient();
$client->request('GET', $url);
$this->assertResponseRedirects($expectedUrl, $expectedStatusCode);
}
/**
* @return list<array{0: string, 1: string, 2: int}>
*/
protected static function getRedirectionTests(): array
{
return [
// LiveComponent Demos
['/live-component/demos/auto-validating-form', '/demos/live-component/auto-validating-form', 301],
['/live-component/demos/chartjs', '/demos/live-component/chartjs', 301],
['/live-component/demos/dependent-form-fields', '/demos/live-component/dependent-form-fields', 301],
['/live-component/demos/form-collection-type', '/demos/live-component/form-collection-type', 301],
['/live-component/demos/inline-edit', '/demos/live-component/inline-edit', 301],
['/live-component/demos/invoice', '/demos/live-component/invoice', 301],
['/live-component/demos/product-form', '/demos/live-component/product-form', 301],
['/live-component/demos/upload', '/demos/live-component/upload', 301],
['/live-component/demos/voting', '/demos/live-component/voting', 301],
['/live-component/demos', '/demos', 302],
];
}
}