diff --git a/core/lib/Drupal/Core/Test/TestSetupTrait.php b/core/lib/Drupal/Core/Test/TestSetupTrait.php index f7ba3e0279f274805170f394886add080c34ece9..52d640094f5db8ab23843540040dbf3aa4488d1c 100644 --- a/core/lib/Drupal/Core/Test/TestSetupTrait.php +++ b/core/lib/Drupal/Core/Test/TestSetupTrait.php @@ -80,6 +80,20 @@ trait TestSetupTrait { */ protected $kernel; + /** + * The database prefix of this test run. + * + * @var string + */ + protected $databasePrefix; + + /** + * The app root. + * + * @var string + */ + protected $root; + /** * The temporary file directory for the test environment. * diff --git a/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php b/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php index e9d4349483a54380a1b3599f074aefd0310afc73..d678f6be0f1c5d6c560619d52dc837b46e8c3a1e 100644 --- a/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php +++ b/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php @@ -46,13 +46,6 @@ class TestSiteInstallCommand extends Command { */ protected $timeLimit = 500; - /** - * The database prefix of this test run. - * - * @var string - */ - protected $databasePrefix; - /** * The language to install the site in. * diff --git a/core/tests/Drupal/Tests/BrowserTestBase.php b/core/tests/Drupal/Tests/BrowserTestBase.php index 229f38055b5a4a224a7e3b1e34dcd3bb66616686..cd75578c4ebe08e3fc09b893ce0f0f4e1d425631 100644 --- a/core/tests/Drupal/Tests/BrowserTestBase.php +++ b/core/tests/Drupal/Tests/BrowserTestBase.php @@ -73,13 +73,6 @@ abstract class BrowserTestBase extends TestCase { use ExpectDeprecationTrait; use ExtensionListTestTrait; - /** - * The database prefix of this test run. - * - * @var string - */ - protected $databasePrefix; - /** * Time limit in seconds for the test. * @@ -201,13 +194,6 @@ abstract class BrowserTestBase extends TestCase { */ protected $originalShutdownCallbacks = []; - /** - * The app root. - * - * @var string - */ - protected $root; - /** * The original container. * diff --git a/core/tests/Drupal/Tests/Core/Test/TestSetupTraitTest.php b/core/tests/Drupal/Tests/Core/Test/TestSetupTraitTest.php index 7b88af74511c70058fcd9a0d8ac174142f0e7ce1..43dce9fdcc0999d3340e3b9d174fbfd8c4d4cd42 100644 --- a/core/tests/Drupal/Tests/Core/Test/TestSetupTraitTest.php +++ b/core/tests/Drupal/Tests/Core/Test/TestSetupTraitTest.php @@ -35,8 +35,10 @@ public function testChangeDatabasePrefix() { // Create a mock for testing the trait and set a few properties that are // used to avoid unnecessary set up. $test_setup = $this->getMockForTrait(TestSetupTrait::class); - $test_setup->databasePrefix = 'testDbPrefix'; - $test_setup->root = $root; + + $reflection = new \ReflectionClass($test_setup); + $reflection->getProperty('databasePrefix')->setValue($test_setup, 'testDbPrefix'); + $reflection->getProperty('root')->setValue($test_setup, $root); $method = new \ReflectionMethod(get_class($test_setup), 'changeDatabasePrefix'); $method->setAccessible(TRUE);