5
5
*/
6
6
namespace Magento \Framework \Backup ;
7
7
8
+ use \Magento \TestFramework \Helper \Bootstrap ;
9
+ use \Magento \Framework \App \Filesystem \DirectoryList ;
10
+
8
11
class FilesystemTest extends \PHPUnit_Framework_TestCase
9
12
{
10
13
/**
@@ -19,24 +22,33 @@ class FilesystemTest extends \PHPUnit_Framework_TestCase
19
22
20
23
protected function setUp ()
21
24
{
22
- $ this ->objectManager = \ Magento \ TestFramework \ Helper \ Bootstrap::getObjectManager ();
25
+ $ this ->objectManager = Bootstrap::getObjectManager ();
23
26
$ this ->filesystem = $ this ->objectManager ->create (\Magento \Framework \Backup \Filesystem::class);
24
27
}
25
28
29
+ /**
30
+ * @magentoAppIsolation enabled
31
+ */
26
32
public function testRollback ()
27
33
{
28
- $ rootDir = __DIR__ . ' /_files ' ;
29
- $ backupsDir = $ rootDir . '/var/backups ' ;
34
+ $ rootDir = Bootstrap:: getInstance ()-> getAppTempDir () ;
35
+ $ backupsDir = __DIR__ . '/_files /var/backups ' ;
30
36
$ fileName = 'test.txt ' ;
31
37
32
38
$ this ->filesystem ->setRootDir ($ rootDir )
33
39
->setBackupsDir ($ backupsDir )
34
40
->setTime (1474538269 )
35
41
->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
+ ]);
37
50
38
51
$ this ->assertTrue ($ this ->filesystem ->rollback ());
39
52
$ this ->assertTrue (file_exists ($ rootDir . '/ ' . $ fileName ));
40
- $ this ->assertTrue (unlink ($ rootDir . '/ ' . $ fileName ));
41
53
}
42
54
}
0 commit comments