infinito/application/symfony/tests/Integration/Controller/RoutesGetStatusIntegrationTest.php

42 lines
1.0 KiB
PHP
Raw Normal View History

2018-11-22 23:00:01 +01:00
<?php
2019-01-05 16:41:21 +01:00
namespace Tests\Integration\Controller;
2018-11-22 23:00:01 +01:00
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\HttpFoundation\Request;
2019-01-05 21:26:36 +01:00
/**
* @author kevinfrantz
*/
class RoutesGetStatusIntegrationTest extends KernelTestCase
2018-11-22 23:00:01 +01:00
{
2018-11-22 23:18:47 +01:00
const GET_URLS_STATUS = [
'login' => 200,
'imprint' => 200,
'register' => 301,
'logout' => 302,
2018-11-23 13:22:45 +01:00
'profile/edit' => 302,
2019-01-06 02:24:35 +01:00
'spa' => 302,
2018-11-22 23:18:47 +01:00
];
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
}
}
2019-01-05 16:41:21 +01:00
private function parameterlesGetRouteTest(string $url, int $status): void
2018-11-22 23:00:01 +01:00
{
$request = new Request([], [], [], [], [], ['REQUEST_URI' => $url, null]);
$request->setMethod(Request::METHOD_GET);
$response = static::$kernel->handle($request);
$this->assertEquals($status, $response->getStatusCode());
}
}