/** * Fill collection with theme model loaded from filesystem * * @param bool $printQuery * @param bool $logQuery * @return Mage_Core_Model_Theme_Collection */ public function loadData($printQuery = false, $logQuery = false) { if ($this->isLoaded()) { return $this; } $pathsToThemeConfig = array(); foreach ($this->getTargetPatterns() as $directoryPath) { $pathsToThemeConfig = array_merge($pathsToThemeConfig, str_replace('/', DIRECTORY_SEPARATOR, $this->_filesystem->searchKeys($this->getBaseDir(), $directoryPath))); } $this->_loadFromFilesystem($pathsToThemeConfig)->clearTargetPatterns()->_updateRelations()->_renderFilters()->_clearFilters(); return $this; }
/** * @dataProvider searchFilesIsolationDataProvider * @param string $workingDirectory * @param string $baseDirectory * @param string $pattern * @param string $expectedMessage */ public function testSearchFilesIsolation($workingDirectory, $baseDirectory, $pattern, $expectedMessage) { $adapterMock = $this->getMock('Magento_Filesystem_AdapterInterface'); $adapterMock->expects($this->once())->method('isDirectory')->with($workingDirectory)->will($this->returnValue(true)); $filesystem = new Magento_Filesystem($adapterMock); $filesystem->setWorkingDirectory($workingDirectory); $this->setExpectedException('InvalidArgumentException', $expectedMessage); $filesystem->searchKeys($baseDirectory, $pattern); }