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.
40 lines
1.3 KiB
PHP
40 lines
1.3 KiB
PHP
<?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);
|
|
}
|
|
}
|