diff --git a/core/tests/TestSuites/TestSuiteBase.php b/core/tests/TestSuites/TestSuiteBase.php index 08e6637642..41ed61622b 100644 --- a/core/tests/TestSuites/TestSuiteBase.php +++ b/core/tests/TestSuites/TestSuiteBase.php @@ -42,11 +42,11 @@ protected function addTestsBySuiteNamespace($root, $suite_namespace) { // to this is Unit tests for historical reasons. if ($suite_namespace == 'Unit') { $tests = TestDiscovery::scanDirectory("Drupal\\Tests\\", "$root/core/tests/Drupal/Tests"); - $tests = array_filter($tests, function ($test_class) { + $tests = array_flip(array_filter(array_flip($tests), function ($test_class) { // The Listeners directory does not contain tests. Use the class name // to be compatible with all operating systems. return !preg_match('/^Drupal\\\\Tests\\\\Listeners\\\\/', $test_class); - }, ARRAY_FILTER_USE_KEY); + })); $this->addTestFiles($tests); } else {