Skip to content

Commit

Permalink
Test Response::setContent() with actual contents
Browse files Browse the repository at this point in the history
  • Loading branch information
BenMorel committed Mar 6, 2018
1 parent 6a4e2a9 commit d49fd42
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions tests/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,16 @@ public function testSetContent()

public function testSetContentWithResource()
{
$fp = fopen('php://memory', 'rb+');
fwrite($fp, 'data');
fseek($fp, 0);

$response = new Response();

$this->assertSame($response, $response->setContent(fopen('php://input', 'rb')));
$this->assertSame($response, $response->setContent($fp));
$this->assertInstanceOf(MessageBodyResource::class, $response->getBody());
$this->assertSame(0, $response->getBody()->getSize());
$this->assertSame(4, $response->getBody()->getSize());
$this->assertSame('data', (string) $response->getBody());
}

public function testIsStatusCode()
Expand Down

0 comments on commit d49fd42

Please sign in to comment.