Verified Commit c5e50e3f 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

(cherry picked from commit 35130a738e9cd0b606336ec9c5452e3cc40cb07e)
parent 305554cc
Loading
Loading
Loading
Loading
+14 −0
Original line number Diff line number Diff line
@@ -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.
   *
+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
@@ -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.
   *
+4 −2
Original line number Diff line number Diff line
@@ -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);