コード例 #1
0
 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);
 }
コード例 #2
0
 public function testCopyRaiseExceptionIfSourceIsNotReadable()
 {
     $source = Stream::fopen('php://temp', 'w');
     $stream = new Stream();
     $this->setExpectedException('InvalidArgumentException');
     $stream->copy($source);
 }
コード例 #3
0
ファイル: StreamTest.php プロジェクト: easy-system/es-http
 public function testGetContentsReturnEmptyStringWhenResourceIsNotReadable()
 {
     $resource = Stream::fopen('php://temp', 'w');
     $stream = new Stream($resource);
     $this->assertEquals('', $stream->getContents());
 }