blob: 9279e81d28e122958514ae0fd5ef4e99871b6cde (
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
|
<?php
namespace Engelsystem\Test\Unit\Middleware;
use Engelsystem\Middleware\NotFoundResponse;
use PHPUnit\Framework\TestCase;
use PHPUnit_Framework_MockObject_MockObject as MockObject;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Server\RequestHandlerInterface;
class NotFoundResponseTest extends TestCase
{
/**
* @covers \Engelsystem\Middleware\NotFoundResponse::process
*/
public function testRegister()
{
/** @var NotFoundResponse|MockObject $middleware */
$middleware = $this->getMockBuilder(NotFoundResponse::class)
->setMethods(['renderPage'])
->getMock();
/** @var ResponseInterface|MockObject $response */
$response = $this->getMockForAbstractClass(ResponseInterface::class);
/** @var RequestHandlerInterface|MockObject $handler */
$handler = $this->getMockForAbstractClass(RequestHandlerInterface::class);
/** @var ServerRequestInterface|MockObject $request */
$request = $this->getMockForAbstractClass(ServerRequestInterface::class);
$middleware->expects($this->once())
->method('renderPage')
->willReturn($response);
$handler->expects($this->never())
->method('handle');
$middleware->process($request, $handler);
}
}
|