コード例 #1
0
 /**
  * Method to test write().
  *
  * @return void
  *
  * @covers \Windwalker\Http\Stream::write
  */
 public function testWrite()
 {
     $this->createTempFile();
     $resource = fopen($this->tmpnam, Stream::MODE_READ_WRITE_RESET);
     $stream = new Stream($resource);
     $stream->write('flower');
     $this->assertEquals('flower', file_get_contents($this->tmpnam));
     $stream->write(' bloom');
     $this->assertEquals('flower bloom', file_get_contents($this->tmpnam));
     $stream->seek(4);
     $stream->write('test');
     $this->assertEquals('flowtestloom', file_get_contents($this->tmpnam));
 }