public function testMakeCreateInput() { $source = Stream::fopen(); fwrite($source, 'Lorem ipsum dolor sit amet'); InputFactory::setSource($source); $input = InputFactory::make(); $request = ServerRequestFactory::make(); $body = $request->getBody(); $this->assertEquals($body->getContents(), $input->getContents()); InputFactory::setSource(null); }
public function testCopyRaiseExceptionIfSourceIsNotReadable() { $source = Stream::fopen('php://temp', 'w'); $stream = new Stream(); $this->setExpectedException('InvalidArgumentException'); $stream->copy($source); }
public function testGetContentsReturnEmptyStringWhenResourceIsNotReadable() { $resource = Stream::fopen('php://temp', 'w'); $stream = new Stream($resource); $this->assertEquals('', $stream->getContents()); }