From 2e9db3e65c64c0347ab5503cddd112f1d3663dcb Mon Sep 17 00:00:00 2001
From: webchick <drupal@webchick.net>
Date: Mon, 13 Oct 2014 21:22:55 -0700
Subject: [PATCH] Issue #2333747 by jhedstrom, tim.plunkett: Fixed run-tests.sh
 ignores phpunit tests when using the --module flag.

---
 core/modules/simpletest/src/TestDiscovery.php | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/core/modules/simpletest/src/TestDiscovery.php b/core/modules/simpletest/src/TestDiscovery.php
index 1b512b55bb8d..2c86907a5984 100644
--- a/core/modules/simpletest/src/TestDiscovery.php
+++ b/core/modules/simpletest/src/TestDiscovery.php
@@ -207,7 +207,9 @@ public function findAllClassFiles($extension = NULL) {
     $classmap = array();
     $namespaces = $this->registerTestNamespaces();
     if (isset($extension)) {
-      $namespaces = array_intersect_key($namespaces, array_flip(preg_grep('/' . preg_quote("Drupal\\$extension\\", '/') . '/', array_keys($namespaces))));
+      // Include tests in the \Drupal\Tests\{$extension} namespace.
+      $pattern = "/Drupal\\\(Tests\\\)?$extension\\\/";
+      $namespaces = array_intersect_key($namespaces, array_flip(preg_grep($pattern, array_keys($namespaces))));
     }
     foreach ($namespaces as $namespace => $paths) {
       foreach ($paths as $path) {
-- 
GitLab