You are here

public function AppendStreamTest::testCanDetermineSizeFromMultipleStreams in Zircon Profile 8.0

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

File

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

Class

AppendStreamTest

Namespace

GuzzleHttp\Tests\Psr7

Code

public function testCanDetermineSizeFromMultipleStreams() {
  $a = new AppendStream([
    Psr7\stream_for('foo'),
    Psr7\stream_for('bar'),
  ]);
  $this
    ->assertEquals(6, $a
    ->getSize());
  $s = $this
    ->getMockBuilder('Psr\\Http\\Message\\StreamInterface')
    ->setMethods([
    'isSeekable',
    'isReadable',
  ])
    ->getMockForAbstractClass();
  $s
    ->expects($this
    ->once())
    ->method('isSeekable')
    ->will($this
    ->returnValue(null));
  $s
    ->expects($this
    ->once())
    ->method('isReadable')
    ->will($this
    ->returnValue(true));
  $a
    ->addStream($s);
  $this
    ->assertNull($a
    ->getSize());
}