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
/**
@@ -51,7 +50,8 @@ protected function setUp()
51
50
*/
52
51
public function testValidatePath ($ path , $ directoryConfig , $ expectation )
53
52
{
54
- $ path = $ this ->directory ->getAbsolutePath ($ path );
53
+ $ directory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::MEDIA );
54
+ $ path = $ directory ->getAbsolutePath () .'/ ' .$ path ;
55
55
$ this ->assertEquals ($ expectation , $ this ->directoryResolver ->validatePath ($ path , $ directoryConfig ));
56
56
}
57
57
@@ -62,7 +62,8 @@ public function testValidatePath($path, $directoryConfig, $expectation)
62
62
*/
63
63
public function testValidatePathWithException ()
64
64
{
65
- $ path = $ this ->directory ->getAbsolutePath ();
65
+ $ directory = $ this ->filesystem ->getDirectoryWrite (DirectoryList::MEDIA );
66
+ $ path = $ directory ->getAbsolutePath ();
66
67
$ this ->directoryResolver ->validatePath ($ path , 'wrong_dir ' );
67
68
}
68
69
0 commit comments