diff --git a/core/modules/simpletest/tests/modules/phpunit_test/phpunit_test.info.yml b/core/modules/simpletest/tests/modules/phpunit_test/phpunit_test.info.yml
new file mode 100644
index 0000000..e69de29
diff --git a/core/tests/bootstrap.php b/core/tests/bootstrap.php
index 08d8871..6f9d9f2 100644
--- a/core/tests/bootstrap.php
+++ b/core/tests/bootstrap.php
@@ -1,21 +1,66 @@
 <?php
 
-// Register the namespaces we'll need to autoload from.
+/**
+ * @file
+ * Autoloader for Drupal PHPUnit testing.
+ *
+ * @see phpunit.xml.dist
+ */
+
+function drupal_phpunit_find_module_directories($scan_directory) {
+  $module_directories = array();
+  $dir = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($scan_directory));
+  foreach ($dir as $d) {
+    if (strpos($d->getPathname(), 'info.yml') !== FALSE) {
+      $module_directories[] = $d->getPathInfo()->getRealPath();
+    }
+  }
+
+  return $module_directories;
+}
+
+function drupal_phpunit_find_site_module_directories($sites_path) {
+  $module_paths = array_map(function($dir) use ($sites_path) {
+    $module_dir = "$sites_path/$dir/modules";
+    if (is_dir($module_dir)) {
+     return realpath($module_dir);
+    }
+  }, scandir($sites_path));
+  return array_filter($module_paths);
+}
+
+/**
+ * Registers the namespace for each module directory with the autoloader.
+ *
+ * @param ComposerAutoloader $loader
+ *   The supplied autoloader.
+ * @param array $dirs
+ *   An array of module directories.
+ */
+function drupal_phpunit_register_module_dirs($loader, $dirs) {
+  foreach ($dirs as $dir) {
+    $lib_path = $dir . '/lib';
+    if (is_dir($lib_path)) {
+      $loader->add('Drupal\\' . basename($dir), $lib_path);
+    }
+  }
+}
+
+// Start with classes in known locations.
 $loader = require __DIR__ . "/../vendor/autoload.php";
 $loader->add('Drupal\\', __DIR__);
 $loader->add('Drupal\Core', __DIR__ . "/../../core/lib");
 $loader->add('Drupal\Component', __DIR__ . "/../../core/lib");
 
-foreach (scandir(__DIR__ . "/../modules") as $module) {
-  $loader->add('Drupal\\' . $module, __DIR__ . "/../modules/" . $module . "/lib");
-  // Add test module classes.
-  $test_modules_dir = __DIR__ . "/../modules/$module/tests/modules";
-  if (is_dir($test_modules_dir)) {
-    foreach (scandir($test_modules_dir) as $test_module) {
-      $loader->add('Drupal\\' . $test_module, $test_modules_dir . '/' . $test_module . '/lib');
-    }
-  }
-}
+// Scan for arbitrary module namespaces.
+$module_locations = array_merge(array(
+  __DIR__ . "/../modules",
+  __DIR__ . "/../../modules",
+), drupal_phpunit_find_site_module_directories(__DIR__ . "/../../sites"));
+
+$dirs = array_map('drupal_phpunit_find_module_directories', $module_locations);
+$dirs = array_reduce($dirs, 'array_merge', array());
+drupal_phpunit_register_module_dirs($loader, $dirs);
 
 require __DIR__ . "/../../core/lib/Drupal.php";
 // Look into removing this later.
