30 lines
784 B
PHP
30 lines
784 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Tests\Controller;
|
||
|
|
|
||
|
|
use App\Entity\AppSetting;
|
||
|
|
use App\Tests\DatabaseWebTestCase;
|
||
|
|
|
||
|
|
final class HomeControllerTest extends DatabaseWebTestCase
|
||
|
|
{
|
||
|
|
public function testRootRedirectsToAdminWhenNoRedirectUrlIsConfigured(): void
|
||
|
|
{
|
||
|
|
$this->client->request('GET', '/');
|
||
|
|
|
||
|
|
self::assertResponseRedirects('/admin');
|
||
|
|
}
|
||
|
|
|
||
|
|
public function testRootRedirectsToConfiguredUrl(): void
|
||
|
|
{
|
||
|
|
$setting = (new AppSetting())
|
||
|
|
->setName(AppSetting::ROOT_REDIRECT_URL)
|
||
|
|
->setValue('https://example.com/installers');
|
||
|
|
$this->entityManager->persist($setting);
|
||
|
|
$this->entityManager->flush();
|
||
|
|
|
||
|
|
$this->client->request('GET', '/');
|
||
|
|
|
||
|
|
self::assertResponseRedirects('https://example.com/installers');
|
||
|
|
}
|
||
|
|
}
|