diff --git a/core/modules/simpletest/src/TestDiscovery.php b/core/modules/simpletest/src/TestDiscovery.php index 4c762a7..0366f93 100644 --- a/core/modules/simpletest/src/TestDiscovery.php +++ b/core/modules/simpletest/src/TestDiscovery.php @@ -82,6 +82,7 @@ public function registerTestNamespaces() { // Add PHPUnit test namespaces of Drupal core. $this->testNamespaces['Drupal\\Tests\\'] = [DRUPAL_ROOT . '/core/tests/Drupal/Tests']; + $this->testNamespaces['Drupal\\KernelTests\\'] = [DRUPAL_ROOT . '/core/tests/Drupal/KernelTests']; $this->testNamespaces['Drupal\\FunctionalTests\\'] = [DRUPAL_ROOT . '/core/tests/Drupal/FunctionalTests']; $this->availableExtensions = array(); @@ -99,6 +100,7 @@ public function registerTestNamespaces() { // 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"; } diff --git a/core/modules/system/tests/src/Kernel/ModuleHandlerTest.php b/core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php similarity index 100% rename from core/modules/system/tests/src/Kernel/ModuleHandlerTest.php rename to core/modules/system/tests/src/Kernel/Extension/ModuleHandlerTest.php diff --git a/core/phpunit.xml.dist b/core/phpunit.xml.dist index e1d3444..15b6316 100644 --- a/core/phpunit.xml.dist +++ b/core/phpunit.xml.dist @@ -19,7 +19,6 @@ ../sites/*/modules/*/tests/src/Unit ./vendor - ./tests/Drupal/Tests/KernelTestBaseTest.php ./drush/tests diff --git a/core/scripts/run-tests.sh b/core/scripts/run-tests.sh index 174f14d..79fe45c 100755 --- a/core/scripts/run-tests.sh +++ b/core/scripts/run-tests.sh @@ -709,7 +709,7 @@ function simpletest_script_command($test_id, $test_class) { * @see simpletest_script_run_one_test() */ function simpletest_script_cleanup($test_id, $test_class, $exitcode) { - if (strpos($test_class, 'Drupal\\Tests\\') === 0) { + if (is_subclass_of($test_class, '\PHPUnit_Framework_TestCase')) { // PHPUnit test, move on. return; } diff --git a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php index f4e351b..6a5c7e7 100644 --- a/core/tests/Drupal/KernelTests/KernelTestBaseTest.php +++ b/core/tests/Drupal/KernelTests/KernelTestBaseTest.php @@ -63,7 +63,10 @@ public function testGetDatabaseConnectionInfoWithOutManualSetDbUrl() { * @covers ::getDatabaseConnectionInfo */ public function testGetDatabaseConnectionInfoWithManualSetDbUrl() { - putenv('SIMPLETEST_DB=sqlite://localhost/:memory:'); + if (!file_exists('/tmp')) { + $this->markTestSkipped(); + } + putenv('SIMPLETEST_DB=sqlite://localhost//tmp/test2.sqlite'); $this->setUp(); $options = $this->container->get('database')->getConnectionOptions(); diff --git a/core/tests/Drupal/Tests/KernelTestBase.php b/core/tests/Drupal/Tests/KernelTestBase.php index a5504d0..5736739 100644 --- a/core/tests/Drupal/Tests/KernelTestBase.php +++ b/core/tests/Drupal/Tests/KernelTestBase.php @@ -433,7 +433,7 @@ protected function getDatabaseConnectionInfo() { // Clone the current connection and replace the current prefix. $connection_info = Database::getConnectionInfo('default'); if (is_null($connection_info)) { - throw new \InvalidArgumentException('There is no database connection so no tests can be run. You must provide a SIMPLETEST_DB environment variable to run PHPUnit based functional tests outside of run-tests.sh.'); + throw new \InvalidArgumentException('There is no database connection so no tests can be run. You must provide a SIMPLETEST_DB environment variable, like "sqlite://localhost//tmp/test.sqlite", to run PHPUnit based functional tests outside of run-tests.sh.'); } else { Database::renameConnection('default', 'simpletest_original_default');