summaryrefslogtreecommitdiff
path: root/tests/Unit/HelpersTest.php
diff options
context:
space:
mode:
authorIgor Scheller <igor.scheller@igorshp.de>2018-08-11 15:05:55 +0200
committerIgor Scheller <igor.scheller@igorshp.de>2018-08-14 00:17:19 +0200
commitf3f05f6cc4bef3338dbfb6eb340da4fb1c5ba1e1 (patch)
tree88f9767bfb40a68776d4f458ac60c6edfd02e286 /tests/Unit/HelpersTest.php
parent20c03a155d2017101a098cefa602116a4a331d71 (diff)
Make Engelsystem\Http\Response PSR-7 compatible
Diffstat (limited to 'tests/Unit/HelpersTest.php')
-rw-r--r--tests/Unit/HelpersTest.php28
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/Unit/HelpersTest.php b/tests/Unit/HelpersTest.php
index 43c29c84..82030169 100644
--- a/tests/Unit/HelpersTest.php
+++ b/tests/Unit/HelpersTest.php
@@ -6,6 +6,7 @@ use Engelsystem\Application;
use Engelsystem\Config\Config;
use Engelsystem\Container\Container;
use Engelsystem\Http\Request;
+use Engelsystem\Http\Response;
use Engelsystem\Renderer\Renderer;
use Engelsystem\Routing\UrlGenerator;
use PHPUnit\Framework\TestCase;
@@ -127,6 +128,33 @@ class HelpersTest extends TestCase
}
/**
+ * @covers \response
+ */
+ public function testResponse()
+ {
+ /** @var MockObject|Response $response */
+ $response = $this->getMockBuilder(Response::class)->getMock();
+ $this->getAppMock('psr7.response', $response);
+
+ $response->expects($this->once())
+ ->method('withContent')
+ ->with('Lorem Ipsum?')
+ ->willReturn($response);
+
+ $response->expects($this->once())
+ ->method('withStatus')
+ ->with(501)
+ ->willReturn($response);
+
+ $response->expects($this->exactly(2))
+ ->method('withAddedHeader')
+ ->withConsecutive(['lor', 'em'], ['foo', 'bar'])
+ ->willReturn($response);
+
+ $this->assertEquals($response, response('Lorem Ipsum?', 501, ['lor' => 'em', 'foo' => 'bar',]));
+ }
+
+ /**
* @covers \session
*/
public function testSession()