blob: a1cb3117d8ee41a48e50d34a4d4730d25c93b6c3 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
<?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';
}
}
|