Mercurial > hg > isophonics-drupal-site
comparison core/tests/TestSuites/TestSuiteBase.php @ 14:1fec387a4317
Update Drupal core to 8.5.2 via Composer
author | Chris Cannam |
---|---|
date | Mon, 23 Apr 2018 09:46:53 +0100 |
parents | 4c8ae668cc8c |
children |
comparison
equal
deleted
inserted
replaced
13:5fb285c0d0e3 | 14:1fec387a4317 |
---|---|
1 <?php | 1 <?php |
2 | 2 |
3 namespace Drupal\Tests\TestSuites; | 3 namespace Drupal\Tests\TestSuites; |
4 | 4 |
5 use Drupal\simpletest\TestDiscovery; | 5 use Drupal\simpletest\TestDiscovery; |
6 use PHPUnit\Framework\TestSuite; | |
6 | 7 |
7 /** | 8 /** |
8 * Base class for Drupal test suites. | 9 * Base class for Drupal test suites. |
9 */ | 10 */ |
10 abstract class TestSuiteBase extends \PHPUnit_Framework_TestSuite { | 11 abstract class TestSuiteBase extends TestSuite { |
11 | 12 |
12 /** | 13 /** |
13 * Finds extensions in a Drupal installation. | 14 * Finds extensions in a Drupal installation. |
14 * | 15 * |
15 * An extension is defined as a directory with an *.info.yml file in it. | 16 * An extension is defined as a directory with an *.info.yml file in it. |
38 protected function addTestsBySuiteNamespace($root, $suite_namespace) { | 39 protected function addTestsBySuiteNamespace($root, $suite_namespace) { |
39 // Core's tests are in the namespace Drupal\${suite_namespace}Tests\ and are | 40 // Core's tests are in the namespace Drupal\${suite_namespace}Tests\ and are |
40 // always inside of core/tests/Drupal/${suite_namespace}Tests. The exception | 41 // always inside of core/tests/Drupal/${suite_namespace}Tests. The exception |
41 // to this is Unit tests for historical reasons. | 42 // to this is Unit tests for historical reasons. |
42 if ($suite_namespace == 'Unit') { | 43 if ($suite_namespace == 'Unit') { |
43 $this->addTestFiles(TestDiscovery::scanDirectory("Drupal\\Tests\\", "$root/core/tests/Drupal/Tests")); | 44 $tests = TestDiscovery::scanDirectory("Drupal\\Tests\\", "$root/core/tests/Drupal/Tests"); |
45 $tests = array_flip(array_filter(array_flip($tests), function ($test_class) { | |
46 // The Listeners directory does not contain tests. Use the class name | |
47 // to be compatible with all operating systems. | |
48 return !preg_match('/^Drupal\\\\Tests\\\\Listeners\\\\/', $test_class); | |
49 })); | |
50 $this->addTestFiles($tests); | |
44 } | 51 } |
45 else { | 52 else { |
46 $this->addTestFiles(TestDiscovery::scanDirectory("Drupal\\${suite_namespace}Tests\\", "$root/core/tests/Drupal/${suite_namespace}Tests")); | 53 $this->addTestFiles(TestDiscovery::scanDirectory("Drupal\\${suite_namespace}Tests\\", "$root/core/tests/Drupal/${suite_namespace}Tests")); |
47 } | 54 } |
48 | 55 |