@@ -24,8 +24,11 @@ class TestDependencyCheck implements StaticCheckInterface
2424 const  EXTENDS_REGEX_PATTERN  = '/extends=[" \']([^ \'"]*)/ ' ;
2525 const  ACTIONGROUP_REGEX_PATTERN  = '/ref=[" \']([^ \'"]*)/ ' ;
2626
27-  const  ERROR_LOG_FILENAME  = 'mftf-dependency-checks ' ;
27+  const  ERROR_LOG_FILENAME  = 'mftf-dependency-checks-errors  ' ;
2828 const  ERROR_LOG_MESSAGE  = 'MFTF File Dependency Check ' ;
29+  const  WARNING_LOG_FILENAME  = 'mftf-dependency-checks-warnings ' ;
30+ 
31+  const  ALLOW_LIST_FILENAME  = 'test-dependency-allowlist ' ;
2932
3033 /** 
3134 * Array of FullModuleName => [dependencies], including flattened dependency tree 
@@ -51,6 +54,17 @@ class TestDependencyCheck implements StaticCheckInterface
5154 */ 
5255 private  $ errors
5356
57+  /** 
58+  * Array containing all warnings found after running the execute() function. 
59+  * @var array 
60+  */ 
61+  private  $ warnings
62+  /** 
63+  * Array containing warnings found while iterating through files 
64+  * @var array 
65+  */ 
66+  private  $ tempWarnings
67+ 
5468 /** 
5569 * String representing the output summary found after running the execute() function. 
5670 * @var string 
@@ -75,6 +89,11 @@ class TestDependencyCheck implements StaticCheckInterface
7589 */ 
7690 private  $ testDependencyUtil
7791
92+  /** 
93+  * @var array $allowFailureEntities 
94+  */ 
95+  private  $ allowFailureEntities
96+ 
7897 /** 
7998 * Checks test dependencies, determined by references in tests versus the dependencies listed in the Magento module 
8099 * 
@@ -93,6 +112,17 @@ public function execute(InputInterface $input)
93112 "TEST DEPENDENCY CHECK ABORTED: MFTF must be attached or pointing to Magento codebase. " 
94113 );
95114 }
115+ 
116+  foreach  ($ allModulesas  $ modulePath
117+  {
118+  if  (file_exists ($ modulePathDIRECTORY_SEPARATOR  . self ::ALLOW_LIST_FILENAME )) {
119+  $ contentsfile_get_contents ($ modulePathDIRECTORY_SEPARATOR  . self ::ALLOW_LIST_FILENAME );
120+  foreach (explode ("\n" , $ contentsas  $ entity
121+  $ this allowFailureEntities [$ entitytrue ;
122+  }
123+  }
124+  }
125+ 
96126 $ registrarnew  \Magento \Framework \Component \ComponentRegistrar ();
97127 $ this moduleNameToPath  = $ registrargetPaths (\Magento \Framework \Component \ComponentRegistrar::MODULE );
98128 $ this moduleNameToComposerName  = $ this testDependencyUtil ->buildModuleNameToComposerName (
@@ -118,12 +148,20 @@ public function execute(InputInterface $input)
118148 $ this errors  += $ this findErrorsInFileSet ($ actionGroupXmlFiles
119149 $ this errors  += $ this findErrorsInFileSet ($ dataXmlFiles
120150
151+ 
121152 // hold on to the output and print any errors to a file 
122153 $ this output  = $ this scriptUtil ->printErrorsToFile (
123154 $ this errors ,
124155 StaticChecksList::getErrorFilesPath () . DIRECTORY_SEPARATOR  . self ::ERROR_LOG_FILENAME  . '.txt ' ,
125156 self ::ERROR_LOG_MESSAGE 
126157 );
158+  if  (!empty ($ this warnings )) {
159+  $ this output  .= "\n  "  . $ this scriptUtil ->printWarningsToFile (
160+  $ this warnings ,
161+  StaticChecksList::getErrorFilesPath () . DIRECTORY_SEPARATOR  . self ::WARNING_LOG_FILENAME  . '.txt ' ,
162+  self ::ERROR_LOG_MESSAGE 
163+  );
164+  }
127165 }
128166
129167 /** 
@@ -199,6 +237,7 @@ private function findErrorsInFileSet(Finder $files): array
199237 // Find violating references and set error output 
200238 $ violatingReferences$ this findViolatingReferences ($ moduleName
201239 $ testErrorsarray_merge ($ testErrors$ this setErrorOutput ($ violatingReferences$ filePath
240+  $ this warnings  = array_merge ($ this warnings , $ this setErrorOutput ($ this tempWarnings , $ filePath
202241 }
203242 return  $ testErrors
204243 }
@@ -221,6 +260,7 @@ private function findViolatingReferences(string $moduleName): array
221260 );
222261 $ moduleDependencies$ this flattenedDependencies [$ moduleName
223262 foreach  ($ modulesReferencedInTestas  $ entityName$ files
263+  $ isInAllowListarray_key_exists ($ entityName$ this allowFailureEntities );
224264 $ validfalse ;
225265 foreach  ($ filesas  $ module
226266 if  (array_key_exists ($ module$ moduleDependencies$ module$ currentModule
@@ -229,6 +269,10 @@ private function findViolatingReferences(string $moduleName): array
229269 }
230270 }
231271 if  (!$ valid
272+  if  ($ isInAllowList
273+  $ this tempWarnings [$ entityName$ files
274+  continue ;
275+  }
232276 $ violatingReferences$ entityName$ files
233277 }
234278 }
0 commit comments