returns a list of children for this directory
public getChildren ( ) : org\bovigo\vfs\vfsStreamContent[] | ||
return | org\bovigo\vfs\vfsStreamContent[] |
public function testShouldBeAbleToDeleteExistingFile() { $localDelete = new DefaultDelete($this->root->url() . '/testfile1'); $localDelete->execute(); $this->assertEquals(1, count($this->root->getChildren())); $this->assertEquals('testfile2', $this->root->getChildren()[0]->getName()); }
public function testFileIsNotOnSourceAfterShift() { $copy = new DefaultShift($this->root->url() . '/testfile1', $this->root->url() . '/testfile1Shifted'); $copy->execute(); $this->assertEquals(2, count($this->root->getChildren())); $this->assertNull($this->root->getChild('testfile1')); }
/** * @test */ public function does_execute_rename_file_when_configured() { $manager = $this->getMock(ManagerInterface::class); $strategy = $this->getMock(Strategy::class); $strategy->expects($this->once())->method('getConfiguration')->will($this->returnValue(['after' => ['rename' => true]])); $import = $this->getMock(Import::class); $import->expects($this->once())->method('getStrategy')->will($this->returnValue($strategy)); $file = vfsStream::newFile('import.csv')->at($this->root)->setContent("test;test"); $oldFileName = $file->getName(); $this->fileService->expects($this->any())->method('getFileAbsFileName')->will($this->returnCallback(function () use($file) { return $file->url(); })); $this->fixture->execute($manager, $import); $children = $this->root->getChildren(); $this->assertEquals(1, sizeof($children)); $this->assertRegExp('/^[0-9]{14}_' . $oldFileName . '$/', $children[0]->getName()); }
/** * Gets a virtual file at a specified index. * * @param $index * * @return \org\bovigo\vfs\vfsStreamContent */ public function getFileAtIndex($index) { return $this->vfs->getChildren()[$index]; }