8
8
namespace Magento \ImportExport \Controller \Adminhtml \Export \File ;
9
9
10
10
use Magento \Framework \App \Filesystem \DirectoryList ;
11
+ use Magento \Framework \Filesystem ;
12
+ use Magento \ImportExport \Controller \Adminhtml \Export \File \Delete ;
13
+ use Magento \TestFramework \Helper \Bootstrap ;
11
14
12
15
/**
13
16
* Test for \Magento\ImportExport\Controller\Adminhtml\Export\File\Delete class.
14
17
*/
15
18
class DeleteTest extends \PHPUnit \Framework \TestCase
16
19
{
17
20
/**
18
- * @var \Magento\ImportExport\Controller\Adminhtml\Export\File\ Delete
21
+ * @var Delete
19
22
*/
20
23
private $ model ;
21
24
@@ -35,7 +38,7 @@ class DeleteTest extends \PHPUnit\Framework\TestCase
35
38
private $ fileName = 'catalog_product.csv ' ;
36
39
37
40
/**
38
- * @var \Magento\Framework\ Filesystem
41
+ * @var Filesystem
39
42
*/
40
43
private $ filesystem ;
41
44
@@ -49,15 +52,15 @@ class DeleteTest extends \PHPUnit\Framework\TestCase
49
52
*/
50
53
protected function setUp ()
51
54
{
52
- $ this ->objectManager = \ Magento \ TestFramework \ Helper \ Bootstrap::getObjectManager ();
53
- $ this ->filesystem = $ this ->objectManager ->get (\ Magento \ Framework \ Filesystem::class);
55
+ $ this ->objectManager = Bootstrap::getObjectManager ();
56
+ $ this ->filesystem = $ this ->objectManager ->get (Filesystem::class);
54
57
$ this ->varDirectory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::VAR_DIR );
55
58
$ this ->varDirectory ->create ($ this ->varDirectory ->getRelativePath ('export ' ));
56
59
$ this ->fullDirectoryPath = $ this ->varDirectory ->getAbsolutePath ('export ' );
57
60
$ filePath = $ this ->fullDirectoryPath . DIRECTORY_SEPARATOR . $ this ->fileName ;
58
61
$ fixtureDir = realpath (__DIR__ . '/../../Import/_files ' );
59
62
copy ($ fixtureDir . '/ ' . $ this ->fileName , $ filePath );
60
- $ this ->model = $ this ->objectManager ->get (\ Magento \ ImportExport \ Controller \ Adminhtml \ Export \ File \ Delete::class);
63
+ $ this ->model = $ this ->objectManager ->get (Delete::class);
61
64
}
62
65
63
66
/**
@@ -71,9 +74,7 @@ public function testExecute()
71
74
$ this ->model ->execute ();
72
75
73
76
$ this ->assertFalse (
74
- $ this ->varDirectory ->isExist (
75
- $ this ->varDirectory ->getRelativePath ( 'export/ ' . $ this ->fileName )
76
- )
77
+ $ this ->varDirectory ->isExist ($ this ->varDirectory ->getRelativePath ('export/ ' . $ this ->fileName ))
77
78
);
78
79
}
79
80
@@ -82,8 +83,7 @@ public function testExecute()
82
83
*/
83
84
public static function tearDownAfterClass ()
84
85
{
85
- $ filesystem = \Magento \TestFramework \Helper \Bootstrap::getObjectManager ()
86
- ->get (\Magento \Framework \Filesystem::class);
86
+ $ filesystem = Bootstrap::getObjectManager ()->get (Filesystem::class);
87
87
/** @var \Magento\Framework\Filesystem\Directory\WriteInterface $directory */
88
88
$ directory = $ filesystem ->getDirectoryWrite (DirectoryList::VAR_DIR );
89
89
if ($ directory ->isExist ('export ' )) {
0 commit comments