You are here

public function StreamWrapperTest::testCanOpenReadonlyStream in Zircon Profile 8

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

File

vendor/guzzlehttp/psr7/tests/StreamWrapperTest.php, line 85

Class

StreamWrapperTest
@covers GuzzleHttp\Psr7\StreamWrapper

Namespace

GuzzleHttp\Tests\Psr7

Code

public function testCanOpenReadonlyStream() {
  $stream = $this
    ->getMockBuilder('Psr\\Http\\Message\\StreamInterface')
    ->setMethods([
    'isReadable',
    'isWritable',
  ])
    ->getMockForAbstractClass();
  $stream
    ->expects($this
    ->once())
    ->method('isReadable')
    ->will($this
    ->returnValue(false));
  $stream
    ->expects($this
    ->once())
    ->method('isWritable')
    ->will($this
    ->returnValue(true));
  $r = StreamWrapper::getResource($stream);
  $this
    ->assertInternalType('resource', $r);
  fclose($r);
}