You are here

public function FnStreamTest::testDecoratesWithCustomizations in Zircon Profile 8

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

File

vendor/guzzlehttp/psr7/tests/FnStreamTest.php, line 77

Class

FnStreamTest
@covers GuzzleHttp\Psr7\FnStream

Namespace

GuzzleHttp\Tests\Psr7

Code

public function testDecoratesWithCustomizations() {
  $called = false;
  $a = Psr7\stream_for('foo');
  $b = FnStream::decorate($a, [
    'read' => function ($len) use (&$called, $a) {
      $called = true;
      return $a
        ->read($len);
    },
  ]);
  $this
    ->assertEquals('foo', $b
    ->read(3));
  $this
    ->assertTrue($called);
}