Move into nested docroot
This commit is contained in:
parent
83a0d3a149
commit
c8b70abde9
13405 changed files with 0 additions and 0 deletions
27
web/core/tests/TestSuites/FunctionalJavascriptTestSuite.php
Normal file
27
web/core/tests/TestSuites/FunctionalJavascriptTestSuite.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\TestSuites;
|
||||
|
||||
require_once __DIR__ . '/TestSuiteBase.php';
|
||||
|
||||
/**
|
||||
* Discovers tests for the functional-javascript test suite.
|
||||
*/
|
||||
class FunctionalJavascriptTestSuite extends TestSuiteBase {
|
||||
|
||||
/**
|
||||
* Factory method which loads up a suite with all functional javascript tests.
|
||||
*
|
||||
* @return static
|
||||
* The test suite.
|
||||
*/
|
||||
public static function suite() {
|
||||
$root = dirname(dirname(dirname(__DIR__)));
|
||||
|
||||
$suite = new static('functional-javascript');
|
||||
$suite->addTestsBySuiteNamespace($root, 'FunctionalJavascript');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
|
||||
}
|
27
web/core/tests/TestSuites/FunctionalTestSuite.php
Normal file
27
web/core/tests/TestSuites/FunctionalTestSuite.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\TestSuites;
|
||||
|
||||
require_once __DIR__ . '/TestSuiteBase.php';
|
||||
|
||||
/**
|
||||
* Discovers tests for the functional test suite.
|
||||
*/
|
||||
class FunctionalTestSuite extends TestSuiteBase {
|
||||
|
||||
/**
|
||||
* Factory method which loads up a suite with all functional tests.
|
||||
*
|
||||
* @return static
|
||||
* The test suite.
|
||||
*/
|
||||
public static function suite() {
|
||||
$root = dirname(dirname(dirname(__DIR__)));
|
||||
|
||||
$suite = new static('functional');
|
||||
$suite->addTestsBySuiteNamespace($root, 'Functional');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
|
||||
}
|
27
web/core/tests/TestSuites/KernelTestSuite.php
Normal file
27
web/core/tests/TestSuites/KernelTestSuite.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\TestSuites;
|
||||
|
||||
require_once __DIR__ . '/TestSuiteBase.php';
|
||||
|
||||
/**
|
||||
* Discovers tests for the kernel test suite.
|
||||
*/
|
||||
class KernelTestSuite extends TestSuiteBase {
|
||||
|
||||
/**
|
||||
* Factory method which loads up a suite with all kernel tests.
|
||||
*
|
||||
* @return static
|
||||
* The test suite.
|
||||
*/
|
||||
public static function suite() {
|
||||
$root = dirname(dirname(dirname(__DIR__)));
|
||||
|
||||
$suite = new static('kernel');
|
||||
$suite->addTestsBySuiteNamespace($root, 'Kernel');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
|
||||
}
|
60
web/core/tests/TestSuites/TestSuiteBase.php
Normal file
60
web/core/tests/TestSuites/TestSuiteBase.php
Normal file
|
@ -0,0 +1,60 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\TestSuites;
|
||||
use Drupal\simpletest\TestDiscovery;
|
||||
|
||||
/**
|
||||
* Base class for Drupal test suites.
|
||||
*/
|
||||
abstract class TestSuiteBase extends \PHPUnit_Framework_TestSuite {
|
||||
|
||||
/**
|
||||
* Finds extensions in a Drupal installation.
|
||||
*
|
||||
* An extension is defined as a directory with an *.info.yml file in it.
|
||||
*
|
||||
* @param string $root
|
||||
* Path to the root of the Drupal installation.
|
||||
*
|
||||
* @return string[]
|
||||
* Associative array of extension paths, with extension name as keys.
|
||||
*/
|
||||
protected function findExtensionDirectories($root) {
|
||||
$extension_roots = \drupal_phpunit_contrib_extension_directory_roots($root);
|
||||
|
||||
$extension_directories = array_map('drupal_phpunit_find_extension_directories', $extension_roots);
|
||||
return array_reduce($extension_directories, 'array_merge', array());
|
||||
}
|
||||
|
||||
/**
|
||||
* Find and add tests to the suite for core and any extensions.
|
||||
*
|
||||
* @param string $root
|
||||
* Path to the root of the Drupal installation.
|
||||
* @param string $suite_namespace
|
||||
* SubNamespace used to separate test suite. Examples: Unit, Functional.
|
||||
*/
|
||||
protected function addTestsBySuiteNamespace($root, $suite_namespace) {
|
||||
// Core's tests are in the namespace Drupal\${suite_namespace}Tests\ and are
|
||||
// always inside of core/tests/Drupal/${suite_namespace}Tests. The exception
|
||||
// to this is Unit tests for historical reasons.
|
||||
if ($suite_namespace == 'Unit') {
|
||||
$this->addTestFiles(TestDiscovery::scanDirectory("Drupal\\Tests\\", "$root/core/tests/Drupal/Tests"));
|
||||
}
|
||||
else {
|
||||
$this->addTestFiles(TestDiscovery::scanDirectory("Drupal\\${suite_namespace}Tests\\", "$root/core/tests/Drupal/${suite_namespace}Tests"));
|
||||
}
|
||||
|
||||
// Extensions' tests will always be in the namespace
|
||||
// Drupal\Tests\$extension_name\$suite_namespace\ and be in the
|
||||
// $extension_path/tests/src/$suite_namespace directory. Not all extensions
|
||||
// will have all kinds of tests.
|
||||
foreach ($this->findExtensionDirectories($root) as $extension_name => $dir) {
|
||||
$test_path = "$dir/tests/src/$suite_namespace";
|
||||
if (is_dir($test_path)) {
|
||||
$this->addTestFiles(TestDiscovery::scanDirectory("Drupal\\Tests\\$extension_name\\$suite_namespace\\", $test_path));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
27
web/core/tests/TestSuites/UnitTestSuite.php
Normal file
27
web/core/tests/TestSuites/UnitTestSuite.php
Normal file
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
|
||||
namespace Drupal\Tests\TestSuites;
|
||||
|
||||
require_once __DIR__ . '/TestSuiteBase.php';
|
||||
|
||||
/**
|
||||
* Discovers tests for the unit test suite.
|
||||
*/
|
||||
class UnitTestSuite extends TestSuiteBase {
|
||||
|
||||
/**
|
||||
* Factory method which loads up a suite with all unit tests.
|
||||
*
|
||||
* @return static
|
||||
* The test suite.
|
||||
*/
|
||||
public static function suite() {
|
||||
$root = dirname(dirname(dirname(__DIR__)));
|
||||
|
||||
$suite = new static('unit');
|
||||
$suite->addTestsBySuiteNamespace($root, 'Unit');
|
||||
|
||||
return $suite;
|
||||
}
|
||||
|
||||
}
|
Reference in a new issue