public function testDrainsResponseIntoSaveToBodyAtPath() { $tmpfname = tempnam('/tmp', 'save_to_path'); $this->queueRes(); $handler = new StreamHandler(); $request = new Request('GET', Server::$url); $response = $handler($request, ['sink' => $tmpfname])->wait(); $body = $response->getBody(); $this->assertEquals($tmpfname, $body->getMetadata('uri')); $this->assertEquals('hi', $body->read(2)); $body->close(); unlink($tmpfname); }