Skip to content
This repository was archived by the owner on Jun 4, 2025. It is now read-only.

Commit d49fd42

Browse files
committed
Test Response::setContent() with actual contents
1 parent 6a4e2a9 commit d49fd42

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

tests/ResponseTest.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,16 @@ public function testSetContent()
115115

116116
public function testSetContentWithResource()
117117
{
118+
$fp = fopen('php://memory', 'rb+');
119+
fwrite($fp, 'data');
120+
fseek($fp, 0);
121+
118122
$response = new Response();
119123

120-
$this->assertSame($response, $response->setContent(fopen('php://input', 'rb')));
124+
$this->assertSame($response, $response->setContent($fp));
121125
$this->assertInstanceOf(MessageBodyResource::class, $response->getBody());
122-
$this->assertSame(0, $response->getBody()->getSize());
126+
$this->assertSame(4, $response->getBody()->getSize());
127+
$this->assertSame('data', (string) $response->getBody());
123128
}
124129

125130
public function testIsStatusCode()

0 commit comments

Comments
 (0)