/**
  * @covers Brickoo\Component\IO\Printing\BufferedPrinter::doPrint
  * @covers Brickoo\Component\IO\Printing\StreamBufferedPrinter::getStreamWriter
  */
 public function testStreamWriteResourceIsRefreshed()
 {
     $stream = new FileStream(new FileStreamConfig("php://memory", FileStream::MODE_READ + FileStream::MODE_WRITE));
     $streamPrinter = new StreamBufferedPrinter($stream, strlen("test"));
     $streamPrinter->doPrint("test");
     $streamPrinter->doPrint("Case");
     $streamPrinter->flushBuffer();
     fseek($stream->open(), 0);
     $this->assertSame("testCase", fgets($stream->open()));
     $stream->close();
 }
示例#2
0
 /**
  * @covers Brickoo\Component\IO\Stream\FileStream::close
  * @covers Brickoo\Component\IO\Stream\FileStream::open
  * @covers Brickoo\Component\IO\Stream\FileStream::__destruct
  */
 public function testDestructionClosesFileStream()
 {
     $fileStream = new FileStream($this->getFileStreamConfigurationFixture());
     $this->assertInternalType("resource", $fileStream->open());
     unset($fileStream);
     $fileStream = null;
 }