diff options
author | msquare <msquare@notrademark.de> | 2018-09-04 18:24:11 +0200 |
---|---|---|
committer | msquare <msquare@notrademark.de> | 2018-09-04 18:24:11 +0200 |
commit | b320fc779063ee80b8f0ba505cb323287ccccbf5 (patch) | |
tree | 1e420597ae72c979361bf29b66ae7e27c73cf431 /tests/Unit/Http/ResponseTest.php | |
parent | 9f1ee0c6c6497d43fb275491ec53fda420f64b81 (diff) | |
parent | 36dafdb68acbde2fe42ce36ef50f497c8c06411f (diff) |
Merge branch 'MyIgel-rebuild-psr7'
Diffstat (limited to 'tests/Unit/Http/ResponseTest.php')
-rw-r--r-- | tests/Unit/Http/ResponseTest.php | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/tests/Unit/Http/ResponseTest.php b/tests/Unit/Http/ResponseTest.php new file mode 100644 index 00000000..f6c24767 --- /dev/null +++ b/tests/Unit/Http/ResponseTest.php @@ -0,0 +1,49 @@ +<?php + +namespace Engelsystem\Test\Unit\Http; + +use Engelsystem\Http\Response; +use PHPUnit\Framework\TestCase; +use Psr\Http\Message\ResponseInterface; +use Symfony\Component\HttpFoundation\Response as SymfonyResponse; + +class ResponseTest extends TestCase +{ + /** + * @covers \Engelsystem\Http\Response + */ + public function testCreate() + { + $response = new Response(); + $this->assertInstanceOf(SymfonyResponse::class, $response); + $this->assertInstanceOf(ResponseInterface::class, $response); + } + + /** + * @covers \Engelsystem\Http\Response::withStatus + * @covers \Engelsystem\Http\Response::getReasonPhrase + */ + public function testWithStatus() + { + $response = new Response(); + $newResponse = $response->withStatus(503); + $this->assertNotEquals($response, $newResponse); + $this->assertNotEquals('', $newResponse->getReasonPhrase()); + $this->assertEquals(503, $newResponse->getStatusCode()); + + $newResponse = $response->withStatus(503, 'Foo'); + $this->assertEquals('Foo', $newResponse->getReasonPhrase()); + } + + /** + * @covers \Engelsystem\Http\Response::withContent + */ + public function testWithContent() + { + $response = new Response(); + $newResponse = $response->withContent('Lorem Ipsum?'); + + $this->assertNotEquals($response, $newResponse); + $this->assertEquals('Lorem Ipsum?', $newResponse->getContent()); + } +} |