summaryrefslogtreecommitdiff
path: root/tests/Unit/HelpersTest.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/HelpersTest.php
parent9f1ee0c6c6497d43fb275491ec53fda420f64b81 (diff)
parentb0e7bc0df2eb4975223582089c7a928903e8cd14 (diff)
Merge remote-tracking branch 'MyIgel/rebuild-psr7'
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 9514ad8c..cd001df9 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\UrlGeneratorInterface;
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()