public function testParent() { $FolderModel = $this->getMock('DoublesSearchBundle\\Model\\FolderModel'); $FolderModel->expects($this->any())->method('getFullPath')->will($this->returnValue('Root/Folder')); $f = new FolderModel($FolderModel); $f->setName('myFile'); $p = $f->getParent(); $this->assertEquals($p->getFullPath(), 'Root/Folder'); }
protected function processFolder(FolderModel $path) { $manager = $this->getManager(); $res = $manager->scanFolder($path->getFullPath()); if (count($res[$manager::FOLDERS_ARRAY]) > 0) { foreach ($res[$manager::FOLDERS_ARRAY] as $folder) { $child = new FolderModel($path); $child->setName($folder); $this->processFolder($child); } } if (count($res[$manager::FILES_ARRAY]) > 0) { foreach ($res[$manager::FILES_ARRAY] as $file) { $this->addFile($file, $path); } } }