You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.3 KiB
PHTML
44 lines
1.3 KiB
PHTML
5 years ago
|
<?php
|
||
|
|
||
|
namespace Engelsystem\Test\Unit\Config;
|
||
|
|
||
|
use FastRoute\RouteCollector;
|
||
|
use PHPUnit\Framework\MockObject\MockObject;
|
||
|
use PHPUnit\Framework\TestCase;
|
||
|
|
||
|
class RoutesFileTest extends TestCase
|
||
|
{
|
||
|
/**
|
||
|
* @doesNotPerformAssertions
|
||
|
*/
|
||
|
public function testLoadRoutes()
|
||
|
{
|
||
|
/** @var RouteCollector|MockObject $route */
|
||
|
$route = $this->getMockBuilder(RouteCollector::class)
|
||
|
->disableOriginalConstructor()
|
||
|
->onlyMethods(['addRoute'])
|
||
|
->getMock();
|
||
|
|
||
|
$this->doesNotPerformAssertions();
|
||
|
/** @see RouteCollector::addRoute */
|
||
|
$route->expects($this->any())
|
||
|
->method('addRoute')
|
||
|
->willReturnCallback(function ($httpMethod, $route, $handler) {
|
||
|
/**
|
||
|
* @param string|string[] $httpMethod
|
||
|
* @param string $route
|
||
|
* @param mixed $handler
|
||
|
*/
|
||
|
if (is_string($handler) || (is_array($handler) && is_string($handler[0]))) {
|
||
|
return;
|
||
|
}
|
||
|
|
||
|
$this->fail(
|
||
|
sprintf('The route "%s %s" is not cacheable', implode(',', (array)$httpMethod), $route)
|
||
|
);
|
||
|
});
|
||
|
|
||
|
require __DIR__ . '/../../../config/routes.php';
|
||
|
}
|
||
|
}
|