File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
dev/tests/integration/testsuite/Magento/Framework/Filesystem/Driver
lib/internal/Magento/Framework/Filesystem/Driver Expand file tree Collapse file tree 2 files changed +30
-1
lines changed Original file line number Diff line number Diff line change @@ -64,6 +64,32 @@ protected function tearDown(): void
64
64
$ this ->removeGeneratedDirectory ();
65
65
}
66
66
67
+ /**
68
+ * Tests read directory with symlynked folders.
69
+ *
70
+ * @return void
71
+ */
72
+ public function testReadDirectoryRecursivelyWithSymlinkedFolders (): void
73
+ {
74
+ $ sourceDirectory = $ this ->generatedPath . '/source ' ;
75
+ $ destinationDirectory = $ this ->generatedPath . '/destination ' ;
76
+
77
+ $ this ->driver ->createDirectory ($ sourceDirectory );
78
+ $ this ->driver ->createDirectory ($ sourceDirectory . '/directory1 ' );
79
+ $ this ->driver ->createDirectory ($ destinationDirectory );
80
+
81
+ $ linkName = $ destinationDirectory . '/link ' ;
82
+ $ this ->driver ->symlink ($ sourceDirectory , $ linkName );
83
+
84
+ $ paths = [
85
+ $ destinationDirectory . '/link ' . '/directory1 ' ,
86
+ $ destinationDirectory . '/link '
87
+
88
+ ];
89
+ $ actual = $ this ->driver ->readDirectoryRecursively ($ destinationDirectory );
90
+ $ this ->assertEquals ($ paths , $ actual );
91
+ }
92
+
67
93
/**
68
94
* Tests directory recursive read.
69
95
*
Original file line number Diff line number Diff line change @@ -949,7 +949,10 @@ protected function getScheme($scheme = null)
949
949
public function readDirectoryRecursively ($ path = null )
950
950
{
951
951
$ result = [];
952
- $ flags = \FilesystemIterator::SKIP_DOTS | \FilesystemIterator::UNIX_PATHS ;
952
+ $ flags = \FilesystemIterator::SKIP_DOTS |
953
+ \FilesystemIterator::UNIX_PATHS |
954
+ \RecursiveDirectoryIterator::FOLLOW_SYMLINKS ;
955
+
953
956
try {
954
957
$ iterator = new \RecursiveIteratorIterator (
955
958
new \RecursiveDirectoryIterator ($ path , $ flags ),
You can’t perform that action at this time.
0 commit comments