diff options
Diffstat (limited to 'tests/Unit/HelpersTest.php')
-rw-r--r-- | tests/Unit/HelpersTest.php | 28 |
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() |