2018-09-05 09:11:08 +02:00
|
|
|
<?php
|
2018-09-05 19:12:57 +02:00
|
|
|
|
2019-02-17 14:33:19 +01:00
|
|
|
namespace Infinito\Tests\Unit\Controller;
|
2018-09-05 09:11:08 +02:00
|
|
|
|
2018-09-05 18:05:59 +02:00
|
|
|
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
|
2019-02-17 14:33:19 +01:00
|
|
|
use Infinito\Controller\DefaultController;
|
2019-02-21 18:46:57 +01:00
|
|
|
use Infinito\DBAL\Types\RESTResponseType;
|
2018-09-05 09:11:08 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @author kevinfrantz
|
|
|
|
*/
|
2018-09-05 18:05:59 +02:00
|
|
|
class DefaultControllerTest extends WebTestCase
|
2018-09-05 09:11:08 +02:00
|
|
|
{
|
2018-09-05 16:00:12 +02:00
|
|
|
/**
|
2018-09-21 19:28:57 +02:00
|
|
|
* @var DefaultController
|
2018-09-05 16:00:12 +02:00
|
|
|
*/
|
2018-09-05 09:11:08 +02:00
|
|
|
protected $defaultController;
|
2018-09-12 22:25:22 +02:00
|
|
|
|
|
|
|
public function setUp(): void
|
|
|
|
{
|
|
|
|
$this->defaultController = new DefaultController();
|
2018-09-05 09:11:08 +02:00
|
|
|
}
|
2018-09-12 22:25:22 +02:00
|
|
|
|
|
|
|
public function testHomepage(): void
|
|
|
|
{
|
2018-09-05 18:05:59 +02:00
|
|
|
$client = static::createClient();
|
|
|
|
$client->request('GET', '/');
|
2019-02-24 11:14:13 +01:00
|
|
|
$this->assertEquals(200, $client->getResponse()
|
|
|
|
->getStatusCode());
|
2018-09-05 09:11:08 +02:00
|
|
|
}
|
2018-09-12 22:25:22 +02:00
|
|
|
|
|
|
|
public function testImprint(): void
|
|
|
|
{
|
2018-09-05 18:05:59 +02:00
|
|
|
$client = static::createClient();
|
2019-02-24 11:14:13 +01:00
|
|
|
foreach (RESTResponseType::getChoices() as $format) {
|
|
|
|
$format = 'html';
|
|
|
|
$url = '/api/rest/source/imprint.'.$format;
|
|
|
|
$client->request('GET', $url);
|
|
|
|
$this->assertEquals(200, $client->getResponse()
|
|
|
|
->getStatusCode(), "Route $url is not reachable.");
|
|
|
|
}
|
2018-09-05 09:11:08 +02:00
|
|
|
}
|
|
|
|
}
|