10 require_once
__DIR__ .
'/_files/io.php';
17 private $objectManager;
41 require
__DIR__ .
'/_files/app_dirs.php';
46 require
__DIR__ .
'/_files/app_dirs_rollback.php';
52 $this->_backupDbMock = $this->createMock(\
Magento\Framework\Backup\Db::class);
53 $this->_backupDbMock->expects($this->any())->method(
'setBackupExtension')->will($this->returnSelf());
55 $this->_backupDbMock->expects($this->any())->method(
'setTime')->will($this->returnSelf());
57 $this->_backupDbMock->expects($this->any())->method(
'setBackupsDir')->will($this->returnSelf());
59 $this->_backupDbMock->expects($this->any())->method(
'setResourceModel')->will($this->returnSelf());
61 $this->_backupDbMock->expects(
66 $this->returnValue(
'\unexistingpath')
69 $this->_backupDbMock->expects($this->any())->method(
'create')->will($this->returnValue(
true));
71 $this->_filesystemMock = $this->createMock(\
Magento\Framework\Filesystem::class);
72 $dirMock = $this->getMockForAbstractClass(\
Magento\Framework\
Filesystem\Directory\WriteInterface::class);
73 $this->_filesystemMock->expects($this->any())
74 ->method(
'getDirectoryWrite')
75 ->will($this->returnValue($dirMock));
77 $this->_backupFactoryMock = $this->createMock(\
Magento\Framework\Backup\Factory::class);
78 $this->_backupFactoryMock->expects(
83 $this->returnValue($this->_backupDbMock)
86 $this->fsMock = $this->createMock(\
Magento\Framework\Backup\
Filesystem\Rollback\Fs::class);
95 $this->_backupFactoryMock->expects($this->once())->method(
'create');
97 $rootDir = TESTS_TEMP_DIR .
'/Magento/Backup/data';
99 $model = $this->objectManager->getObject(
100 \
Magento\Framework\Backup\Nomedia::class,
102 'filesystem' => $this->_filesystemMock,
103 'backupFactory' => $this->_backupFactoryMock,
104 'rollBackFs' => $this->fsMock,
110 $this->assertTrue(
$model->getIsSuccess());
120 return [[
'create'], [
'rollback']];
defined('TESTS_BP')||define('TESTS_BP' __DIR__