diff --git a/core/tests/Drupal/Tests/Core/Scripts/TestSiteApplicationTest.php b/core/tests/Drupal/Tests/Core/Scripts/TestSiteApplicationTest.php index 21104a3341..2417b88797 100644 --- a/core/tests/Drupal/Tests/Core/Scripts/TestSiteApplicationTest.php +++ b/core/tests/Drupal/Tests/Core/Scripts/TestSiteApplicationTest.php @@ -31,13 +31,6 @@ */ class TestSiteApplicationTest extends UnitTestCase { - /** - * Environment variables for the processes run by this test. - * - * @var array - */ - protected $env; - /** * {@inheritdoc} */ @@ -54,10 +47,6 @@ protected function setUp() { if (!getenv('SIMPLETEST_DB')) { $this->markTestSkipped('This test requires the environment variable SIMPLETEST_DB to set. See core/phpunit.xml.dist.'); } - // The SIMPLETEST_BASE_URL variable is required by FunctionalTestSetupTrait. - $this->env = [ - 'SIMPLETEST_BASE_URL' => getenv('SIMPLETEST_BASE_URL'), - ]; } /** @@ -72,7 +61,7 @@ public function testInstallScript() { $process = new Process($command_line, $this->root); // Set the timeout to a value that allows debugging. $process->setTimeout(500); - $process->run(NULL, $this->env); + $process->run(); $this->assertSame(0, $process->getExitCode()); $result = json_decode($process->getOutput(), TRUE); @@ -101,10 +90,10 @@ public function testInstallScript() { // Install another site so we can ensure the tear down command only removes // one site at a time. Use the regular output. $command_line = $php_binary_path . ' core/scripts/test-site.php install --setup-file core/tests/Drupal/TestSite/TestSiteInstallTestScript.php --db-url "' . getenv('SIMPLETEST_DB') . '"'; - $process = new Process($command_line, $this->root, $this->env); + $process = new Process($command_line, $this->root); // Set the timeout to a value that allows debugging. $process->setTimeout(500); - $process->run(NULL, $this->env); + $process->run(); $this->assertContains('Successfully installed a test site', $process->getOutput()); $this->assertSame(0, $process->getExitCode()); $regex = '/Database prefix\s+([^\s]*)/'; @@ -119,10 +108,10 @@ public function testInstallScript() { // Now test the tear down process as well, but keep the lock. $command_line = $php_binary_path . ' core/scripts/test-site.php tear-down ' . $db_prefix . ' --keep-lock --db-url "' . getenv('SIMPLETEST_DB') . '"'; - $process = new Process($command_line, $this->root, $this->env); + $process = new Process($command_line, $this->root); // Set the timeout to a value that allows debugging. $process->setTimeout(500); - $process->run(NULL, $this->env); + $process->run(); $this->assertSame(0, $process->getExitCode()); $this->assertContains("Successfully uninstalled $db_prefix test site", $process->getOutput()); @@ -142,10 +131,10 @@ public function testInstallScript() { $test_site_settings = $this->root . DIRECTORY_SEPARATOR . $test_database->getTestSitePath() . DIRECTORY_SEPARATOR . 'settings.php'; $this->assertTrue(unlink($test_site_settings)); $command_line = $php_binary_path . ' core/scripts/test-site.php tear-down ' . $other_db_prefix . ' --db-url "' . getenv('SIMPLETEST_DB') . '"'; - $process = new Process($command_line, $this->root, $this->env); + $process = new Process($command_line, $this->root); // Set the timeout to a value that allows debugging. $process->setTimeout(500); - $process->run(NULL, $this->env); + $process->run(); $this->assertSame(0, $process->getExitCode()); $this->assertContains("Successfully uninstalled $other_db_prefix test site", $process->getOutput()); @@ -175,9 +164,9 @@ public function testInstallInDifferentLanguage() { $php_binary_path = $php_binary_finder->find(); $command_line = $php_binary_path . ' core/scripts/test-site.php install --json --langcode fr --setup-file core/tests/Drupal/TestSite/TestSiteInstallTestScript.php --db-url "' . getenv('SIMPLETEST_DB') . '"'; - $process = new Process($command_line, $this->root, $this->env); + $process = new Process($command_line, $this->root); $process->setTimeout(500); - $process->run(NULL, $this->env); + $process->run(); $this->assertEquals(0, $process->getExitCode()); $result = json_decode($process->getOutput(), TRUE); @@ -193,9 +182,9 @@ public function testInstallInDifferentLanguage() { // Now test the tear down process as well. $command_line = $php_binary_path . ' core/scripts/test-site.php tear-down ' . $db_prefix . ' --db-url "' . getenv('SIMPLETEST_DB') . '"'; - $process = new Process($command_line, $this->root, $this->env); + $process = new Process($command_line, $this->root); $process->setTimeout(500); - $process->run(NULL, $this->env); + $process->run(); $this->assertSame(0, $process->getExitCode()); // Ensure that all the tables for this DB prefix are gone. @@ -211,9 +200,9 @@ public function testTearDownDbPrefixValidation() { $php_binary_path = $php_binary_finder->find(); $command_line = $php_binary_path . ' core/scripts/test-site.php tear-down not-a-valid-prefix'; - $process = new Process($command_line, $this->root, $this->env); + $process = new Process($command_line, $this->root); $process->setTimeout(500); - $process->run(NULL, $this->env); + $process->run(); $this->assertSame(1, $process->getExitCode()); $this->assertContains('Invalid database prefix: not-a-valid-prefix', $process->getErrorOutput()); }