Issue #3298906 by andypost, alexpott: Fix \Drupal\Tests\Core\Test\TestSetupTraitTest::testChangeDatabasePrefix() on PHP 8.2

merge-requests/2103/head^2
Alex Pott 2022-08-31 09:36:37 +01:00
parent 4024e3c478
commit 471e827a09
No known key found for this signature in database
GPG Key ID: BDA67E7EE836E5CE
4 changed files with 18 additions and 23 deletions

View File

@ -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.
*

View File

@ -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.
*

View File

@ -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.
*

View File

@ -35,8 +35,10 @@ class TestSetupTraitTest extends UnitTestCase {
// 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);