commit 52513a62745fe5d36b13ff772f867cb4f6a00f8e
Author: sun <sun@unleashedmind.com>
Date:   Fri Jul 11 20:37:22 2014 +0200

    Issue #2260121 by sun: Prepare test discovery + PHPUnit tests for namespace change.

diff --git a/core/modules/migrate/tests/src/MigrateSqlSourceTestCase.php b/core/modules/migrate/tests/src/MigrateSqlSourceTestCase.php
index 471ed76..d39ec5b 100644
--- a/core/modules/migrate/tests/src/MigrateSqlSourceTestCase.php
+++ b/core/modules/migrate/tests/src/MigrateSqlSourceTestCase.php
@@ -79,7 +79,7 @@ protected function setUp() {
       ->method('getHighWater')
       ->will($this->returnValue(static::ORIGINAL_HIGH_WATER));
     // Need the test class, not the original because we need a setDatabase method. This is not pretty :/
-    $plugin_class  = preg_replace('/^(Drupal\\\\\w+\\\\)Plugin\\\\migrate(\\\\source(\\\\.+)?\\\\)([^\\\\]+)$/', '\1Tests\2Test\4', static::PLUGIN_CLASS);
+    $plugin_class  = preg_replace('/^Drupal\\\\(\w+)\\\\Plugin\\\\migrate(\\\\source(\\\\.+)?\\\\)([^\\\\]+)$/', 'Drupal\\Tests\\\$1\\Unit$2Test$4', static::PLUGIN_CLASS);
     $plugin = new $plugin_class($this->migrationConfiguration['source'], $this->migrationConfiguration['source']['plugin'], array(), $migration);
     $plugin->setDatabase($this->getDatabase($this->databaseContents + array('test_map' => array())));
     $plugin->setModuleHandler($module_handler);
diff --git a/core/modules/migrate_drupal/src/Tests/destination/ConfigDestinationTest.php b/core/modules/migrate/tests/src/destination/ConfigTest.php
similarity index 80%
rename from core/modules/migrate_drupal/src/Tests/destination/ConfigDestinationTest.php
rename to core/modules/migrate/tests/src/destination/ConfigTest.php
index 2bbbc11..070b5e9 100644
--- a/core/modules/migrate_drupal/src/Tests/destination/ConfigDestinationTest.php
+++ b/core/modules/migrate/tests/src/destination/ConfigTest.php
@@ -2,19 +2,19 @@
 
 /**
  * @file
- * Contains \Drupal\migrate_drupal\Tests\destination\ConfigDestinationTest.
+ * Contains \Drupal\migrate\Tests\destination\ConfigTest.
  */
 
-namespace Drupal\migrate_drupal\Tests\destination;
+namespace Drupal\migrate\Tests\destination;
 
 use Drupal\migrate\Plugin\migrate\destination\Config;
 use Drupal\Tests\UnitTestCase;
 
 /**
- * @coversDefaultClass \Drupal\migrate_drupal\Plugin\migrate\destination\Config
- * @group migrate_drupal
+ * @coversDefaultClass \Drupal\migrate\Plugin\migrate\destination\Config
+ * @group migrate
  */
-class ConfigDestinationTest extends UnitTestCase {
+class ConfigTest extends UnitTestCase {
 
   /**
    * Test the import method.
diff --git a/core/modules/path/tests/src/Field/PathFieldDefinitionTest.php b/core/modules/path/tests/src/Field/PathFieldDefinitionTest.php
index bd3efa7..f2974cd 100644
--- a/core/modules/path/tests/src/Field/PathFieldDefinitionTest.php
+++ b/core/modules/path/tests/src/Field/PathFieldDefinitionTest.php
@@ -26,7 +26,7 @@ protected function getPluginId() {
    * {@inheritdoc}
    */
   protected function getModuleAndPath() {
-    return array('path', dirname(dirname(dirname(__DIR__))));
+    return array('path', dirname(dirname(dirname(dirname(__DIR__)))));
   }
 
   /**
diff --git a/core/modules/simpletest/src/TestDiscovery.php b/core/modules/simpletest/src/TestDiscovery.php
index 144e2a4..26b598f 100644
--- a/core/modules/simpletest/src/TestDiscovery.php
+++ b/core/modules/simpletest/src/TestDiscovery.php
@@ -81,20 +81,17 @@ public function registerTestNamespaces() {
     foreach ($this->getExtensions() as $name => $extension) {
       $this->availableExtensions[$extension->getType()][$name] = $name;
 
-      $base_namespace = "Drupal\\$name\\";
       $base_path = DRUPAL_ROOT . '/' . $extension->getPath();
 
       // Add namespace of disabled/uninstalled extensions.
-      if (!isset($existing[$base_namespace])) {
-        $this->classLoader->addPsr4($base_namespace, "$base_path/src");
+      if (!isset($existing["Drupal\\$name\\"])) {
+        $this->classLoader->addPsr4("Drupal\\$name\\", "$base_path/src");
       }
       // Add Simpletest test namespace.
-      $this->testNamespaces[$base_namespace . 'Tests\\'][] = "$base_path/src/Tests";
+      $this->testNamespaces["Drupal\\$name\\Tests\\"][] = "$base_path/src/Tests";
 
       // Add PHPUnit test namespace.
-      // @todo Move PHPUnit namespace of extensions into Drupal\Tests\$name.
-      // @see https://www.drupal.org/node/2260121
-      $this->testNamespaces[$base_namespace . 'Tests\\'][] = "$base_path/tests/src";
+      $this->testNamespaces["Drupal\\Tests\\$name\\"][] = "$base_path/tests/src";
     }
 
     foreach ($this->testNamespaces as $prefix => $paths) {
diff --git a/core/modules/simpletest/src/Tests/SimpleTestBrowserTest.php b/core/modules/simpletest/src/Tests/SimpleTestBrowserTest.php
index 3472c30..6cd695b 100644
--- a/core/modules/simpletest/src/Tests/SimpleTestBrowserTest.php
+++ b/core/modules/simpletest/src/Tests/SimpleTestBrowserTest.php
@@ -135,7 +135,7 @@ public function testTestingThroughUI() {
     $this->drupalGet('admin/config/development/testing');
     $edit = array(
       // A PHPUnit test.
-      'tests[Drupal\action\Tests\Menu\ActionLocalTasksTest]' => TRUE,
+      'tests[Drupal\Tests\action\Unit\Menu\ActionLocalTasksTest]' => TRUE,
     );
     $this->drupalPostForm(NULL, $edit, t('Run tests'));
     $this->assertText('0 fails, 0 exceptions');
diff --git a/core/modules/simpletest/tests/src/phpunit_error.xml b/core/modules/simpletest/tests/fixtures/phpunit_error.xml
similarity index 100%
rename from core/modules/simpletest/tests/src/phpunit_error.xml
rename to core/modules/simpletest/tests/fixtures/phpunit_error.xml
diff --git a/core/modules/simpletest/tests/src/Fixtures/select_2nd_selected.html b/core/modules/simpletest/tests/fixtures/select_2nd_selected.html
similarity index 100%
rename from core/modules/simpletest/tests/src/Fixtures/select_2nd_selected.html
rename to core/modules/simpletest/tests/fixtures/select_2nd_selected.html
diff --git a/core/modules/simpletest/tests/src/Fixtures/select_none_selected.html b/core/modules/simpletest/tests/fixtures/select_none_selected.html
similarity index 100%
rename from core/modules/simpletest/tests/src/Fixtures/select_none_selected.html
rename to core/modules/simpletest/tests/fixtures/select_none_selected.html
diff --git a/core/modules/simpletest/tests/src/PhpUnitErrorTest.php b/core/modules/simpletest/tests/src/PhpUnitErrorTest.php
index 4139859..d57d805 100644
--- a/core/modules/simpletest/tests/src/PhpUnitErrorTest.php
+++ b/core/modules/simpletest/tests/src/PhpUnitErrorTest.php
@@ -17,15 +17,10 @@ class PhpUnitErrorTest extends UnitTestCase {
    * @covers ::simpletest_phpunit_xml_to_rows
    */
   public function testPhpUnitXmlParsing() {
-    // This test class could be either in tests/Drupal/simpletest/Tests/, or in
-    // tests/src/, after the PSR-4 transition.
-    if (file_exists(__DIR__ . '/../../simpletest.module')) {
-      require_once __DIR__ . '/../../simpletest.module';
-    }
-    else {
-      require_once __DIR__ . '/../../../../simpletest.module';
-    }
-    $phpunit_error_xml = __DIR__ . '/phpunit_error.xml';
+    require_once __DIR__ . '/../../../simpletest.module';
+
+    $phpunit_error_xml = __DIR__ . '/../../fixtures/phpunit_error.xml';
+
     $res = simpletest_phpunit_xml_to_rows(1, $phpunit_error_xml);
     $this->assertEquals(count($res), 4, 'All testcases got extracted');
     $this->assertNotEquals($res[0]['status'], 'pass');
diff --git a/core/modules/simpletest/tests/src/WebTestBaseTest.php b/core/modules/simpletest/tests/src/WebTestBaseTest.php
index 0c2cb1c..962f6fa 100644
--- a/core/modules/simpletest/tests/src/WebTestBaseTest.php
+++ b/core/modules/simpletest/tests/src/WebTestBaseTest.php
@@ -50,7 +50,7 @@ public function providerAssertFieldByName() {
    * @covers ::assertFieldByName
    */
   public function testAssertFieldByName($filename, $name, $value, $expected) {
-    $content = file_get_contents(__DIR__ . '/Fixtures/' . $filename . '.html');
+    $content = file_get_contents(__DIR__ . '/../../fixtures/' . $filename . '.html');
 
     $web_test = $this->getMockBuilder('Drupal\simpletest\WebTestBase')
       ->disableOriginalConstructor()
diff --git a/core/modules/views/tests/src/ViewsDataHelperTest.php b/core/modules/views/tests/src/ViewsDataHelperTest.php
index 260fee7..d630224 100644
--- a/core/modules/views/tests/src/ViewsDataHelperTest.php
+++ b/core/modules/views/tests/src/ViewsDataHelperTest.php
@@ -10,6 +10,7 @@
 use Drupal\Component\Utility\String;
 use Drupal\Tests\UnitTestCase;
 use Drupal\views\ViewsDataHelper;
+use Drupal\views\Tests\ViewTestData;
 
 /**
  * @coversDefaultClass \Drupal\views\ViewsDataHelper
diff --git a/core/modules/views/tests/src/ViewsDataTest.php b/core/modules/views/tests/src/ViewsDataTest.php
index 7f9342c..7b3a883 100644
--- a/core/modules/views/tests/src/ViewsDataTest.php
+++ b/core/modules/views/tests/src/ViewsDataTest.php
@@ -10,6 +10,7 @@
 use Drupal\Core\Language\Language;
 use Drupal\Tests\UnitTestCase;
 use Drupal\views\ViewsData;
+use Drupal\views\Tests\ViewTestData;
 
 /**
  * @coversDefaultClass \Drupal\views\ViewsData
diff --git a/core/tests/bootstrap.php b/core/tests/bootstrap.php
index 99fe34d..e74dc24 100644
--- a/core/tests/bootstrap.php
+++ b/core/tests/bootstrap.php
@@ -62,7 +62,7 @@ function drupal_phpunit_register_extension_dirs(Composer\Autoload\ClassLoader $l
     }
     if (is_dir($dir . '/tests/src')) {
       // Register the PSR-4 directory for PHPUnit test classes.
-      $loader->addPsr4('Drupal\\' . $extension . '\Tests\\', $dir . '/tests/src');
+      $loader->addPsr4('Drupal\\Tests\\' . $extension . '\\', $dir . '/tests/src');
     }
   }
 }
