Ejemplo n.º 1
0
 /**
  * @param string $action
  * @dataProvider actionProvider
  */
 public function testAction($action)
 {
     $this->_backupFactoryMock->expects($this->once())->method('create');
     $rootDir = str_replace('\\', '/', TESTS_TEMP_DIR) . '/Magento/Backup/data';
     $model = new \Magento\Framework\Backup\Media($this->_filesystemMock, $this->_backupFactoryMock);
     $model->setRootDir($rootDir);
     $model->setBackupsDir($rootDir);
     $model->{$action}();
     $this->assertTrue($model->getIsSuccess());
     $this->assertTrue($model->{$action}());
     $ignorePaths = $model->getIgnorePaths();
     $expected = [$rootDir, $rootDir . '/app', $rootDir . '/var/log'];
     $ignored = array_intersect($expected, $ignorePaths);
     sort($ignored);
     $this->assertEquals($expected, $ignored);
 }
Ejemplo n.º 2
0
 /**
  * @param string $action
  * @dataProvider actionProvider
  */
 public function testAction($action)
 {
     $this->_backupFactoryMock->expects($this->once())->method('create');
     $rootDir = TESTS_TEMP_DIR . '/Magento/Backup/data';
     $model = new \Magento\Framework\Backup\Media($this->_filesystemMock, $this->_backupFactoryMock);
     $model->setRootDir($rootDir);
     $model->setBackupsDir($rootDir);
     $model->{$action}();
     $this->assertTrue($model->getIsSuccess());
     $this->assertTrue($model->{$action}());
     $ignorePaths = $model->getIgnorePaths();
     $rootDir = str_replace('\\', '/', $rootDir);
     foreach ($ignorePaths as &$path) {
         if (strpos($path, '~tmp-') || strpos($path, '_media')) {
             unlink($path);
         }
         $path = str_replace('\\', '/', $path);
     }
     $this->assertTrue(in_array($rootDir, $ignorePaths));
     $this->assertTrue(in_array($rootDir . '/code', $ignorePaths));
     $this->assertTrue(in_array($rootDir . '/var/log', $ignorePaths));
 }