public function FunctionsTest::testCanCreateIteratorBasedStream in Zircon Profile 8
Same name and namespace in other branches
- 8.0 vendor/guzzlehttp/psr7/tests/FunctionsTest.php \GuzzleHttp\Tests\Psr7\FunctionsTest::testCanCreateIteratorBasedStream()
File
- vendor/
guzzlehttp/ psr7/ tests/ FunctionsTest.php, line 415
Class
Namespace
GuzzleHttp\Tests\Psr7Code
public function testCanCreateIteratorBasedStream() {
$a = new \ArrayIterator([
'foo',
'bar',
'123',
]);
$p = Psr7\stream_for($a);
$this
->assertInstanceOf('GuzzleHttp\\Psr7\\PumpStream', $p);
$this
->assertEquals('foo', $p
->read(3));
$this
->assertFalse($p
->eof());
$this
->assertEquals('b', $p
->read(1));
$this
->assertEquals('a', $p
->read(1));
$this
->assertEquals('r12', $p
->read(3));
$this
->assertFalse($p
->eof());
$this
->assertEquals('3', $p
->getContents());
$this
->assertTrue($p
->eof());
$this
->assertEquals(9, $p
->tell());
}