Verified Commit d2653f73 authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3298906 by andypost, alexpott: Fix...

Issue #3298906 by andypost, alexpott: Fix \Drupal\Tests\Core\Test\TestSetupTraitTest::testChangeDatabasePrefix() on PHP 8.2
parent 689225c9
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -82,6 +82,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.
   *
+0 −7
Original line number Diff line number Diff line
@@ -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.
   *
+0 −14
Original line number Diff line number Diff line
@@ -75,13 +75,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.
   *
@@ -203,13 +196,6 @@ abstract class BrowserTestBase extends TestCase {
   */
  protected $originalShutdownCallbacks = [];

  /**
   * The app root.
   *
   * @var string
   */
  protected $root;

  /**
   * The original container.
   *
+8 −2
Original line number Diff line number Diff line
@@ -35,8 +35,14 @@ 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);
    $property = $reflection->getProperty('databasePrefix');
    $property->setAccessible(TRUE);
    $property->setValue($test_setup, 'testDbPrefix');
    $property = $reflection->getProperty('root');
    $property->setAccessible(TRUE);
    $property->setValue($test_setup, $root);

    $method = new \ReflectionMethod(get_class($test_setup), 'changeDatabasePrefix');
    $method->setAccessible(TRUE);