mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-10 14:27:28 +01:00
45 lines
1.2 KiB
PHP
45 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Infinito\Tests\Unit\Controller;
|
|
|
|
use Infinito\Controller\DefaultController;
|
|
use Infinito\DBAL\Types\RESTResponseType;
|
|
use Infinito\Domain\Fixture\FixtureSource\ImpressumFixtureSource;
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
|
|
|
/**
|
|
* @author kevinfrantz
|
|
*/
|
|
class DefaultControllerTest extends WebTestCase
|
|
{
|
|
/**
|
|
* @var DefaultController
|
|
*/
|
|
protected $defaultController;
|
|
|
|
public function setUp(): void
|
|
{
|
|
$this->defaultController = new DefaultController();
|
|
}
|
|
|
|
public function testHomepage(): void
|
|
{
|
|
$client = static::createClient();
|
|
$client->request('GET', '/');
|
|
$this->assertEquals(302, $client->getResponse()
|
|
->getStatusCode());
|
|
}
|
|
|
|
public function testImprint(): void
|
|
{
|
|
$client = static::createClient();
|
|
foreach (RESTResponseType::getValues() as $format) {
|
|
$format = 'html';
|
|
$url = '/api/rest/source/'.ImpressumFixtureSource::getSlug().'.'.$format;
|
|
$client->request('GET', $url);
|
|
$this->assertEquals(200, $client->getResponse()
|
|
->getStatusCode(), "Route $url is not reachable.");
|
|
}
|
|
}
|
|
}
|