6
6
7
7
namespace Magento \Framework \App \Filesystem ;
8
8
9
+ use Magento \Framework \App \Filesystem \DirectoryList ;
9
10
use Magento \TestFramework \Helper \Bootstrap ;
10
11
11
12
/**
@@ -24,9 +25,9 @@ class DirectoryResolverTest extends \PHPUnit_Framework_TestCase
24
25
private $ directoryResolver ;
25
26
26
27
/**
27
- * @var \Magento\Framework\Filesystem\Directory\WriteInterface
28
+ * @var \Magento\Framework\Filesystem
28
29
*/
29
- private $ directory ;
30
+ private $ filesystem ;
30
31
31
32
/**
32
33
* @inheritdoc
@@ -36,9 +37,7 @@ protected function setUp()
36
37
$ this ->objectManager = Bootstrap::getObjectManager ();
37
38
$ this ->directoryResolver = $ this ->objectManager
38
39
->create (\Magento \Framework \App \Filesystem \DirectoryResolver::class);
39
- /** @var \Magento\Framework\Filesystem $filesystem */
40
- $ filesystem = $ this ->objectManager ->create (\Magento \Framework \Filesystem::class);
41
- $ this ->directory = $ filesystem ->getDirectoryWrite (\Magento \Framework \App \Filesystem \DirectoryList::MEDIA );
40
+ $ this ->filesystem = $ this ->objectManager ->create (\Magento \Framework \Filesystem::class);
42
41
}
43
42
44
43
/**
@@ -47,10 +46,12 @@ protected function setUp()
47
46
* @param bool $expectation
48
47
* @dataProvider validatePathDataProvider
49
48
* @magentoAppIsolation enabled
49
+ * @return void
50
50
*/
51
51
public function testValidatePath ($ path , $ directoryConfig , $ expectation )
52
52
{
53
- $ path = $ this ->directory ->getAbsolutePath ($ path );
53
+ $ directory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::MEDIA );
54
+ $ path = $ directory ->getAbsolutePath () .'/ ' .$ path ;
54
55
$ this ->assertEquals ($ expectation , $ this ->directoryResolver ->validatePath ($ path , $ directoryConfig ));
55
56
}
56
57
@@ -60,7 +61,8 @@ public function testValidatePath($path, $directoryConfig, $expectation)
60
61
*/
61
62
public function testValidatePathWithException ()
62
63
{
63
- $ path = $ this ->directory ->getAbsolutePath ();
64
+ $ directory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::MEDIA );
65
+ $ path = $ directory ->getAbsolutePath ();
64
66
$ this ->directoryResolver ->validatePath ($ path , 'wrong_dir ' );
65
67
}
66
68
@@ -76,7 +78,7 @@ public function validatePathDataProvider()
76
78
true ,
77
79
],
78
80
[
79
- '/../../pub/ ' ,
81
+ '/../../pub/ ' ,
80
82
DirectoryList::MEDIA ,
81
83
false ,
82
84
],
0 commit comments