@@ -169,15 +169,21 @@ public function mergeDependenciesForExtendingTests(
169169 }
170170 $ testDependencies = [];
171171 foreach ($ temp_array as $ testDependencyArray ) {
172- $ flag = false ;
173- foreach ($ filterList ['excludeGroup ' ] as $ filterListData ) {
174- $ contents = file_get_contents ($ testDependencyArray [0 ]["file_path " ]);
175- if (str_contains ($ contents , $ filterListData )) {
176- $ flag = true ;
177- }
178- }
179- if ($ flag == false ) {
172+ $ domDocument = new \DOMDocument ();
173+ $ domDocument ->load ($ testDependencyArray [0 ]["file_path " ]);
174+ $ filterResult = $ this ->getAttributesFromDOMNodeList (
175+ $ domDocument ->getElementsByTagName ("group " ),
176+ ["type " => "value " ]
177+ );
178+ $ excludeGroup = $ filterList ['excludeGroup ' ]??[];
179+ if (count (array_intersect (
180+ call_user_func_array ('array_merge ' , $ filterResult ),
181+ $ excludeGroup
182+ ))==0
183+ ) {
180184 $ testDependencies [] = [
185+ 'filter ' => call_user_func_array ('array_merge ' , $ filterResult ),
186+ 'excludeGroup ' =>$ filterList ['excludeGroup ' ],
181187 "file_path " => array_column ($ testDependencyArray , 'file_path ' ),
182188 "full_name " => $ testDependencyArray [0 ]["full_name " ],
183189 "test_name " => $ testDependencyArray [0 ]["test_name " ],
@@ -194,4 +200,28 @@ public function mergeDependenciesForExtendingTests(
194200 }
195201 return $ testDependencies ;
196202 }
203+
204+ /**
205+ * Return attribute value for each node in DOMNodeList as an array
206+ *
207+ * @param DOMNodeList $nodes
208+ * @param string $attributeName
209+ * @return array
210+ */
211+ private function getAttributesFromDOMNodeList ($ nodes , $ attributeName )
212+ {
213+ $ attributes = [];
214+ foreach ($ nodes as $ node ) {
215+ if (is_string ($ attributeName )) {
216+ $ attributeValues = $ node ->getAttribute ($ attributeName );
217+ } else {
218+ $ attributeValues = [$ node ->getAttribute (key ($ attributeName )) =>
219+ $ node ->getAttribute ($ attributeName [key ($ attributeName )])];
220+ }
221+ if (!empty ($ attributeValues )) {
222+ $ attributes [] = array_values ($ attributeValues );
223+ }
224+ }
225+ return array_values ($ attributes );
226+ }
197227}
0 commit comments