File tree Expand file tree Collapse file tree 2 files changed +33
-1
lines changed
src/Magento/FunctionalTestingFramework Expand file tree Collapse file tree 2 files changed +33
-1
lines changed Original file line number Diff line number Diff line change 5
5
*/
6
6
namespace Magento \FunctionalTestingFramework \Composer \Util ;
7
7
8
+ use Magento \FunctionalTestingFramework \Exceptions \TestFrameworkException ;
9
+
8
10
/**
9
11
* Class ComposerJsonFinder searches composer json file for possible test module code paths
10
12
*/
@@ -33,4 +35,34 @@ public function findAllComposerJsonFiles($directory)
33
35
return $ jsonFileList ;
34
36
}
35
37
}
38
+
39
+ /**
40
+ * Find absolute paths of all composer json files in a given directory at certain depths
41
+ *
42
+ * @param string $directory
43
+ * @param integer $depth
44
+ * @return array
45
+ */
46
+ public function finComposerJsonFilesAtDepth ($ directory , $ depth )
47
+ {
48
+ $ directory = realpath ($ directory );
49
+ $ jsonPattern = DIRECTORY_SEPARATOR . "composer.json " ;
50
+ $ subDirectoryPattern = DIRECTORY_SEPARATOR . "* " ;
51
+
52
+ $ jsonFileList = [];
53
+ if ($ depth > 0 ) {
54
+ foreach (glob ($ directory . $ subDirectoryPattern , GLOB_ONLYDIR ) as $ dir ) {
55
+ $ jsonFileList = array_merge_recursive (
56
+ $ jsonFileList ,
57
+ self ::finComposerJsonFilesAtDepth ($ dir , $ depth -1 )
58
+ );
59
+ }
60
+ } elseif ($ depth == 0 ) {
61
+ $ jsonFileList = glob ($ directory . $ jsonPattern );
62
+ if ($ jsonFileList === false ) {
63
+ $ jsonFileList = [];
64
+ }
65
+ }
66
+ return $ jsonFileList ;
67
+ }
36
68
}
Original file line number Diff line number Diff line change @@ -107,7 +107,7 @@ private function getTestModules($directory)
107
107
// Find all composer json files under directory
108
108
$ modules = [];
109
109
$ jsonFinder = new ComposerJsonFinder ();
110
- $ fileList = $ jsonFinder ->findAllComposerJsonFiles ($ normalizedDir );
110
+ $ fileList = $ jsonFinder ->finComposerJsonFilesAtDepth ($ normalizedDir, 2 );
111
111
foreach ($ fileList as $ file ) {
112
112
// Parse composer json for test module name and path information
113
113
$ composerInfo = new ComposerPackager (
You can’t perform that action at this time.
0 commit comments