/** * @param array $methods * @return Mage_Backup_Snapshot */ public function testGetDbBackupFilename() { $manager = $this->getMock('Mage_Backup_Snapshot', array('getBackupFilename')); $file = 'var/backup/2.gz'; $manager->expects($this->once())->method('getBackupFilename')->will($this->returnValue($file)); $model = new Mage_Backup_Snapshot(); $model->setDbBackupManager($manager); $this->assertEquals($file, $model->getDbBackupFilename()); }
/** * Add all folders and files except media and db backup to ignore list * * @return Mage_Backup_Media */ protected function _prepareIgnoreList() { $rootDir = $this->_snapshotManager->getRootDir(); $map = array($rootDir => array('media', 'var', 'pub'), $rootDir . DIRECTORY_SEPARATOR . 'pub' => array('media'), $rootDir . DIRECTORY_SEPARATOR . 'var' => array($this->_snapshotManager->getDbBackupFilename())); foreach ($map as $path => $whiteList) { foreach (new DirectoryIterator($path) as $item) { $filename = $item->getFilename(); if (!$item->isDot() && !in_array($filename, $whiteList)) { $this->_snapshotManager->addIgnorePaths($item->getPathname()); } } } return $this; }