You are here

public function FunctionsTest::testStopsCopyToStreamWhenWriteFails in Zircon Profile 8

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

File

vendor/guzzlehttp/psr7/tests/FunctionsTest.php, line 44

Class

FunctionsTest

Namespace

GuzzleHttp\Tests\Psr7

Code

public function testStopsCopyToStreamWhenWriteFails() {
  $s1 = Psr7\stream_for('foobaz');
  $s2 = Psr7\stream_for('');
  $s2 = FnStream::decorate($s2, [
    'write' => function () {
      return 0;
    },
  ]);
  Psr7\copy_to_stream($s1, $s2);
  $this
    ->assertEquals('', (string) $s2);
}