infinito/application/tests/Integration/UrlIntegrationTest.php

37 lines
941 B
PHP
Raw Normal View History

2018-11-22 23:00:01 +01:00
<?php
namespace Tests\Integration;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\HttpFoundation\Request;
class UrlIntegrationTest extends KernelTestCase
{
2018-11-22 23:18:47 +01:00
const GET_URLS_STATUS = [
'login' => 200,
'imprint' => 200,
'register' => 301,
'logout' => 302,
];
2018-11-22 23:00:01 +01:00
public function setUp(): void
{
self::bootKernel();
}
2018-11-22 23:18:47 +01:00
public function testParameterlesGetUrls(): void
2018-11-22 23:00:01 +01:00
{
2018-11-22 23:18:47 +01:00
foreach (self::GET_URLS_STATUS as $url => $status) {
$this->parameterlesGetRouteTest($url, $status);
2018-11-22 23:00:01 +01:00
}
}
private function parameterlesGetRouteTest(string $url, int $status)
{
$request = new Request([], [], [], [], [], ['REQUEST_URI' => $url, null]);
$request->setMethod(Request::METHOD_GET);
$response = static::$kernel->handle($request);
$this->assertEquals($status, $response->getStatusCode());
}
}