detach() public method

public detach ( )
Esempio n. 1
0
 public function testReadRaisesExceptionWhenStreamIsDetached()
 {
     $this->tmpnam = tempnam(sys_get_temp_dir(), 'phly');
     file_put_contents($this->tmpnam, 'FOO BAR');
     $resource = fopen($this->tmpnam, 'r');
     $stream = new Stream($resource);
     $stream->detach();
     $this->setExpectedException('RuntimeException', 'No resource');
     $stream->read(4096);
 }
Esempio n. 2
0
 public function testReadReturnsEmptyStringWhenStreamIsDetached()
 {
     $this->tmpnam = tempnam(sys_get_temp_dir(), 'phly');
     file_put_contents($this->tmpnam, 'FOO BAR');
     $resource = fopen($this->tmpnam, 'r');
     $stream = new Stream($resource);
     $stream->detach();
     $this->assertEquals('', $stream->read(4096));
 }