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);
 }
Ejemplo n.º 2
0
 public function testCopyRaiseExceptionIfSourceIsNotReadable()
 {
     $source = Stream::fopen('php://temp', 'w');
     $stream = new Stream();
     $this->setExpectedException('InvalidArgumentException');
     $stream->copy($source);
 }
Ejemplo n.º 3
0
 public function testGetContentsReturnEmptyStringWhenResourceIsNotReadable()
 {
     $resource = Stream::fopen('php://temp', 'w');
     $stream = new Stream($resource);
     $this->assertEquals('', $stream->getContents());
 }