mirror of
https://github.com/kevinveenbirkenbach/infinito.git
synced 2025-01-09 14:07:25 +01:00
Added UrlTester draft
This commit is contained in:
parent
e4c962bbfa
commit
7fbe8ada81
39
application/tests/Integration/UrlIntegrationTest.php
Normal file
39
application/tests/Integration/UrlIntegrationTest.php
Normal 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());
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user