Added UrlTester draft

This commit is contained in:
Kevin Frantz 2018-11-22 23:00:01 +01:00
parent e4c962bbfa
commit 7fbe8ada81

View File

@ -0,0 +1,39 @@
<?php
namespace Tests\Integration;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\HttpFoundation\Request;
class UrlIntegrationTest extends KernelTestCase
{
public function setUp(): void
{
self::bootKernel();
}
/**
* Tests urls which are in general reachable.
*/
public function testParameterlesGetRoutes200(): void
{
foreach (['/login', '/imprint'] as $url) {
$this->parameterlesGetRouteTest($url, 200);
}
}
public function testParameterlesGetRoutes302(): void
{
foreach (['/logout'] as $url) {
$this->parameterlesGetRouteTest($url, 302);
}
}
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());
}
}