예제 #1
0
 /**
  * @expectedException \RuntimeException
  */
 public function testThrowsExceptionWhenStreamFailsToRewind()
 {
     $s = $this->getMockBuilder('GuzzleHttp\\Stream\\StreamInterface')->setMethods(['seek', 'isSeekable'])->getMockForAbstractClass();
     $s->expects($this->once())->method('isSeekable')->will($this->returnValue(true));
     $s->expects($this->once())->method('seek')->will($this->returnValue(false));
     $b = new MultipartBody([], [new PostFile('foo', $s, 'foo.php')]);
     $b->seek(0);
 }
 public function testIsSeekableReturnsTrueIfAllAreSeekable()
 {
     $s = $this->getMockBuilder('GuzzleHttp\\Stream\\StreamInterface')->setMethods(['isSeekable', 'isReadable'])->getMockForAbstractClass();
     $s->expects($this->once())->method('isSeekable')->will($this->returnValue(false));
     $s->expects($this->once())->method('isReadable')->will($this->returnValue(true));
     $p = new PostFile('foo', $s, 'foo.php');
     $b = new MultipartBody([], [$p]);
     $this->assertFalse($b->isSeekable());
     $this->assertFalse($b->seek(10));
 }