You are here

public function AppendStreamTest::testCanReadFromMultipleStreams in Zircon Profile 8

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

File

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

Class

AppendStreamTest

Namespace

GuzzleHttp\Tests\Psr7

Code

public function testCanReadFromMultipleStreams() {
  $a = new AppendStream([
    Psr7\stream_for('foo'),
    Psr7\stream_for('bar'),
    Psr7\stream_for('baz'),
  ]);
  $this
    ->assertFalse($a
    ->eof());
  $this
    ->assertSame(0, $a
    ->tell());
  $this
    ->assertEquals('foo', $a
    ->read(3));
  $this
    ->assertEquals('bar', $a
    ->read(3));
  $this
    ->assertEquals('baz', $a
    ->read(3));
  $this
    ->assertSame('', $a
    ->read(1));
  $this
    ->assertTrue($a
    ->eof());
  $this
    ->assertSame(9, $a
    ->tell());
  $this
    ->assertEquals('foobarbaz', (string) $a);
}