2 declare(strict_types = 1);
19 use Psr\Http\Message\ResponseInterface;
20 use Psr\Http\Message\ServerRequestInterface;
21 use Psr\Http\Server\RequestHandlerInterface;
29 use TYPO3\TestingFramework\Core\Unit\UnitTestCase;
42 $this->requestHandler =
new class implements RequestHandlerInterface {
43 public function handle(ServerRequestInterface $request): ResponseInterface
55 $requestFactoryProphecy = $this->prophesize(RequestFactory::class);
56 $linkServiceProphecy = $this->prophesize(LinkService::class);
58 $requestFactoryProphecy->reveal(),
59 $linkServiceProphecy->reveal()
61 $site =
new Site(
'lotus-flower', 13, [
62 'base' =>
'https://example.com/',
66 'locale' =>
'en_US.UTF-8',
73 'type' =>
'staticText',
78 'type' =>
'staticText',
79 'content' =>
'no-route'
83 'type' =>
'staticText',
84 'content' =>
'empty-route'
87 'route' =>
'/empty-type',
101 $request = $request->withAttribute(
'site', $site);
102 $response = $subject->process($request, $this->requestHandler);
103 self::assertInstanceOf(HtmlResponse::class, $response);
104 self::assertEquals(
'nice', $response->getBody()->getContents());
107 $request = $request->withAttribute(
'site', $site);
108 $response = $subject->process($request, $this->requestHandler);
109 self::assertInstanceOf(NullResponse::class, $response);
112 $request = $request->withAttribute(
'site', $site);
113 $response = $subject->process($request, $this->requestHandler);
114 self::assertInstanceOf(NullResponse::class, $response);