/** * @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()); }
/** * 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()); }
/** * visit a file and process it * * @param vfsStreamFile $file * @return vfsStreamStructureVisitor */ public function visitFile(vfsStreamFile $file) { $this->current[$file->getName()] = $file->getContent(); return $this; }