summaryrefslogtreecommitdiff
path: root/tests/Unit/Middleware/NotFoundResponseTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Unit/Middleware/NotFoundResponseTest.php')
-rw-r--r--tests/Unit/Middleware/NotFoundResponseTest.php39
1 files changed, 39 insertions, 0 deletions
diff --git a/tests/Unit/Middleware/NotFoundResponseTest.php b/tests/Unit/Middleware/NotFoundResponseTest.php
new file mode 100644
index 00000000..9279e81d
--- /dev/null
+++ b/tests/Unit/Middleware/NotFoundResponseTest.php
@@ -0,0 +1,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);
+ }
+}