/**
  * @test
  * @group  issue_33
  * @since  1.1.0
  */
 public function truncateToGreaterSizeAddsZeroBytes()
 {
     $this->assertEquals(11, $this->file->write("lorem ipsum"));
     $this->assertTrue($this->file->truncate(25));
     $this->assertEquals(25, $this->file->size());
     $this->assertEquals("lorem ipsum", $this->file->getContent());
 }
Exemplo n.º 2
0
 /**
  * test writing data into the file
  *
  * @test
  */
 public function write()
 {
     $this->file->setContent('foobarbaz');
     $this->assertTrue($this->file->seek(3, SEEK_SET));
     $this->assertEquals(3, $this->file->write('foo'));
     $this->assertEquals('foofoobaz', $this->file->getContent());
     $this->assertEquals(9, $this->file->size());
     $this->assertEquals(3, $this->file->write('bar'));
     $this->assertEquals('foofoobar', $this->file->getContent());
     $this->assertEquals(9, $this->file->size());
 }
Exemplo n.º 3
0
 /**
  * returns status of stream
  *
  * @return  array
  */
 public function stream_stat()
 {
     $fileStat = array('dev' => 0, 'ino' => 0, 'mode' => $this->content->getType() | $this->content->getPermissions(), 'nlink' => 0, 'uid' => $this->content->getUser(), 'gid' => $this->content->getGroup(), 'rdev' => 0, 'size' => $this->content->size(), 'atime' => $this->content->filemtime(), 'mtime' => $this->content->filemtime(), 'ctime' => $this->content->filemtime(), 'blksize' => -1, 'blocks' => -1);
     return array_merge(array_values($fileStat), $fileStat);
 }