Skip to content

Commit 3e8b228

Browse files
author
Bohdan Korablov
committed
MAGETWO-58523: CLI Rollback doesn't work
1 parent 2d66f75 commit 3e8b228

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

dev/tests/integration/testsuite/Magento/Framework/Backup/FilesystemTest.php

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
namespace Magento\Framework\Backup;
77

8+
use \Magento\TestFramework\Helper\Bootstrap;
9+
use \Magento\Framework\App\Filesystem\DirectoryList;
10+
811
class FilesystemTest extends \PHPUnit_Framework_TestCase
912
{
1013
/**
@@ -19,24 +22,33 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase
1922

2023
protected function setUp()
2124
{
22-
$this->objectManager = \Magento\TestFramework\Helper\Bootstrap::getObjectManager();
25+
$this->objectManager = Bootstrap::getObjectManager();
2326
$this->filesystem = $this->objectManager->create(\Magento\Framework\Backup\Filesystem::class);
2427
}
2528

29+
/**
30+
* @magentoAppIsolation enabled
31+
*/
2632
public function testRollback()
2733
{
28-
$rootDir = __DIR__ . '/_files';
29-
$backupsDir = $rootDir . '/var/backups';
34+
$rootDir = Bootstrap::getInstance()->getAppTempDir();
35+
$backupsDir = __DIR__ . '/_files/var/backups';
3036
$fileName = 'test.txt';
3137

3238
$this->filesystem->setRootDir($rootDir)
3339
->setBackupsDir($backupsDir)
3440
->setTime(1474538269)
3541
->setName('code')
36-
->setBackupExtension('tgz');
42+
->setBackupExtension('tgz')
43+
->addIgnorePaths([
44+
$rootDir . '/' . DirectoryList::CONFIG,
45+
$rootDir . '/' . DirectoryList::VAR_DIR,
46+
$rootDir . '/' . DirectoryList::PUB,
47+
$rootDir . '/defaults_extra.cnf',
48+
$rootDir . '/setup_dump_magento_integration_tests.sql',
49+
]);
3750

3851
$this->assertTrue($this->filesystem->rollback());
3952
$this->assertTrue(file_exists($rootDir . '/' . $fileName));
40-
$this->assertTrue(unlink($rootDir . '/' . $fileName));
4153
}
4254
}

0 commit comments

Comments
 (0)