You are here

public function AppendStreamTest::testTriesToRewindOnSeek in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/guzzlehttp/psr7/tests/AppendStreamTest.php \GuzzleHttp\Tests\Psr7\AppendStreamTest::testTriesToRewindOnSeek()

@expectedException \RuntimeException @expectedExceptionMessage Unable to seek stream 0 of the AppendStream

File

vendor/guzzlehttp/psr7/tests/AppendStreamTest.php, line 39

Class

AppendStreamTest

Namespace

GuzzleHttp\Tests\Psr7

Code

public function testTriesToRewindOnSeek() {
  $a = new AppendStream();
  $s = $this
    ->getMockBuilder('Psr\\Http\\Message\\StreamInterface')
    ->setMethods([
    'isReadable',
    'rewind',
    'isSeekable',
  ])
    ->getMockForAbstractClass();
  $s
    ->expects($this
    ->once())
    ->method('isReadable')
    ->will($this
    ->returnValue(true));
  $s
    ->expects($this
    ->once())
    ->method('isSeekable')
    ->will($this
    ->returnValue(true));
  $s
    ->expects($this
    ->once())
    ->method('rewind')
    ->will($this
    ->throwException(new \RuntimeException()));
  $a
    ->addStream($s);
  $a
    ->seek(10);
}