commit 8e02ab4246bd21956ae7641781eace1ff71d54de Author: Roman Paska Date: Mon Jan 30 18:10:23 2017 +0200 Patch 123456-2. diff --git a/core/modules/simpletest/src/TestDiscovery.php b/core/modules/simpletest/src/TestDiscovery.php index a243ce1..ea78521 100644 --- a/core/modules/simpletest/src/TestDiscovery.php +++ b/core/modules/simpletest/src/TestDiscovery.php @@ -115,14 +115,7 @@ public function registerTestNamespaces() { $this->testNamespaces["Drupal\\$name\\Tests\\"][] = "$base_path/src/Tests"; // Add PHPUnit test namespaces. - $this->testNamespaces["Drupal\\Tests\\$name\\Unit\\"][] = "$base_path/tests/src/Unit"; - $this->testNamespaces["Drupal\\Tests\\$name\\Kernel\\"][] = "$base_path/tests/src/Kernel"; - $this->testNamespaces["Drupal\\Tests\\$name\\Functional\\"][] = "$base_path/tests/src/Functional"; - $this->testNamespaces["Drupal\\Tests\\$name\\FunctionalJavascript\\"][] = "$base_path/tests/src/FunctionalJavascript"; - - // Add discovery for traits which are shared between different test - // suites. - $this->testNamespaces["Drupal\\Tests\\$name\\Traits\\"][] = "$base_path/tests/src/Traits"; + $this->testNamespaces["Drupal\\Tests\\$name\\"][] = "$base_path/tests/src"; } foreach ($this->testNamespaces as $prefix => $paths) { diff --git a/core/modules/simpletest/tests/src/TestTrait.php b/core/modules/simpletest/tests/src/TestTrait.php new file mode 100644 index 0000000..c1d238e --- /dev/null +++ b/core/modules/simpletest/tests/src/TestTrait.php @@ -0,0 +1,31 @@ +stuff; + } + +} diff --git a/core/modules/simpletest/tests/src/Traits/TestTrait.php b/core/modules/simpletest/tests/src/Traits/TestTrait.php deleted file mode 100644 index 6993a26..0000000 --- a/core/modules/simpletest/tests/src/Traits/TestTrait.php +++ /dev/null @@ -1,31 +0,0 @@ -stuff; - } - -} diff --git a/core/modules/simpletest/tests/src/Unit/TraitAccessTest.php b/core/modules/simpletest/tests/src/Unit/TraitAccessTest.php index 8d0324a..0c1a739 100644 --- a/core/modules/simpletest/tests/src/Unit/TraitAccessTest.php +++ b/core/modules/simpletest/tests/src/Unit/TraitAccessTest.php @@ -2,14 +2,15 @@ namespace Drupal\Tests\simpletest\Unit; -use Drupal\Tests\simpletest\Traits\TestTrait; +use Drupal\Tests\UnitTestCase; +use Drupal\Tests\simpletest\TestTrait; /** * Test whether traits are autoloaded during PHPUnit discovery time. * * @group simpletest */ -class TraitAccessTest extends \PHPUnit_Framework_TestCase { +class TraitAccessTest extends UnitTestCase { use TestTrait; diff --git a/core/tests/bootstrap.php b/core/tests/bootstrap.php index ab9bb07..9aeb1d7 100644 --- a/core/tests/bootstrap.php +++ b/core/tests/bootstrap.php @@ -77,28 +77,15 @@ function drupal_phpunit_contrib_extension_directory_roots($root = NULL) { * An associative array of extension directories, keyed by their namespace. */ function drupal_phpunit_get_extension_namespaces($dirs) { - $suite_names = ['Unit', 'Kernel', 'Functional', 'FunctionalJavascript']; $namespaces = array(); foreach ($dirs as $extension => $dir) { if (is_dir($dir . '/src')) { // Register the PSR-4 directory for module-provided classes. $namespaces['Drupal\\' . $extension . '\\'][] = $dir . '/src'; } - $test_dir = $dir . '/tests/src'; - if (is_dir($test_dir)) { - foreach($suite_names as $suite_name) { - $suite_dir = $test_dir . '/' . $suite_name; - if (is_dir($suite_dir)) { - // Register the PSR-4 directory for PHPUnit-based suites. - $namespaces['Drupal\\Tests\\' . $extension . '\\' . $suite_name . '\\'][] = $suite_dir; - } - } - // Extensions can have a \Drupal\extension\Traits namespace for - // cross-suite trait code. - $trait_dir = $test_dir . '/Traits'; - if (is_dir($trait_dir)) { - $namespaces['Drupal\\Tests\\' . $extension . '\\Traits\\'][] = $trait_dir; - } + if (is_dir($dir . '/tests/src')) { + // Register the PSR-4 directory for PHPUnit test classes. + $namespaces['Drupal\\Tests\\' . $extension . '\\'][] = $dir . '/tests/src'; } } return $namespaces;