summaryrefslogtreecommitdiff
path: root/tests/Unit/Middleware/NotFoundResponseTest.php
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-09-03 22:43:19 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2018-09-03 22:55:54 +0200
commit36dafdb68acbde2fe42ce36ef50f497c8c06411f (patch)
tree1e420597ae72c979361bf29b66ae7e27c73cf431 /tests/Unit/Middleware/NotFoundResponseTest.php
parent9f1ee0c6c6497d43fb275491ec53fda420f64b81 (diff)
parentb0e7bc0df2eb4975223582089c7a928903e8cd14 (diff)
Merge remote-tracking branch 'MyIgel/rebuild-psr7'
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);
+ }
+}