diff --git a/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php b/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php index 92f8cad759..3d236f4869 100644 --- a/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php +++ b/core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php @@ -35,7 +35,7 @@ class TestSiteInstallCommand extends Command { * * @var string */ - protected $profile; + protected $profile = 'testing'; /** * Time limit in seconds for the test. @@ -70,7 +70,7 @@ protected function configure() { ->addOption('db_url', NULL, InputOption::VALUE_OPTIONAL, 'URL for database or SIMPLETEST_DB', getenv('SIMPLETEST_DB')) ->addOption('base_url', NULL, InputOption::VALUE_OPTIONAL, 'Base URL for site under test or SIMPLETEST_BASE_URL', getenv('SIMPLETEST_BASE_URL')) ->addOption('install_profile', NULL, InputOption::VALUE_OPTIONAL, 'Install profile to install the site in. Defaults to testing', 'testing') - ->addOption('langcode', NULL, InputOption::VALUE_OPTIONAL, 'The language to install the site in.') + ->addOption('langcode', NULL, InputOption::VALUE_OPTIONAL, 'The language to install the site in. Defaults to en', 'en') ->addOption('json', NULL, InputOption::VALUE_NONE, 'Output test site connection details in JSON'); } @@ -153,7 +153,7 @@ public function setup($profile = 'testing', $setup_class = NULL, $langcode = 'en } /** - * Installs Drupal into the Simpletest site. + * Installs Drupal into the test site. */ protected function installDrupal() { $this->initUserSession(); diff --git a/core/tests/Drupal/TestSite/TestSiteApplication.php b/core/tests/Drupal/TestSite/TestSiteApplication.php index 8ab17fc6a4..02359fbf64 100644 --- a/core/tests/Drupal/TestSite/TestSiteApplication.php +++ b/core/tests/Drupal/TestSite/TestSiteApplication.php @@ -26,7 +26,7 @@ class TestSiteApplication extends Application { /** * TestSiteApplication constructor. * - * @param string $autoloader + * @param object $autoloader * The used PHP autoloader. */ public function __construct($autoloader) { diff --git a/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php b/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php index ba57860cc2..b93e9d5f32 100644 --- a/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php +++ b/core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php @@ -40,51 +40,51 @@ protected function setUp() { * @coversNothing */ public function testInstallWithNonExistingClass() { - $phpBinaryFinder = new PhpExecutableFinder(); - $phpBinaryPath = $phpBinaryFinder->find(); + $php_binary_finder = new PhpExecutableFinder(); + $php_binary_path = $php_binary_finder->find(); // Create a connection to the DB configured in SIMPLETEST_DB. $connection = Database::getConnection('default', $this->addTestDatabase('')); $table_count = count($connection->schema()->findTables('%')); - $command_line = $phpBinaryPath . ' core/scripts/test-site.php install --setup_class "this-class-does-not-exist" --db_url "' . getenv('SIMPLETEST_DB') . '"'; + $command_line = $php_binary_path . ' core/scripts/test-site.php install --setup_class "this-class-does-not-exist" --db_url "' . getenv('SIMPLETEST_DB') . '"'; $process = new Process($command_line, $this->root); $process->run(); $this->assertContains('There was a problem loading this-class-does-not-exist', $process->getErrorOutput()); $this->assertSame(1, $process->getExitCode()); - $this->assertSame($table_count, count($connection->schema()->findTables('%')), 'No additional tables created in the database'); + $this->assertCount($table_count, $connection->schema()->findTables('%'), 'No additional tables created in the database'); } /** * @coversNothing */ public function testInstallWithNonSetupClass() { - $phpBinaryFinder = new PhpExecutableFinder(); - $phpBinaryPath = $phpBinaryFinder->find(); + $php_binary_finder = new PhpExecutableFinder(); + $php_binary_path = $php_binary_finder->find(); // Create a connection to the DB configured in SIMPLETEST_DB. $connection = Database::getConnection('default', $this->addTestDatabase('')); $table_count = count($connection->schema()->findTables('%')); - $command_line = $phpBinaryPath . ' core/scripts/test-site.php install --setup_class "' . static::class . '" --db_url "' . getenv('SIMPLETEST_DB') . '"'; + $command_line = $php_binary_path . ' core/scripts/test-site.php install --setup_class "' . static::class . '" --db_url "' . getenv('SIMPLETEST_DB') . '"'; $process = new Process($command_line, $this->root); $process->run(); $this->assertContains('You need to define a class implementing \Drupal\TestSite\TestSetupInterface', $process->getErrorOutput()); $this->assertSame(1, $process->getExitCode()); - $this->assertSame($table_count, count($connection->schema()->findTables('%')), 'No additional tables created in the database'); + $this->assertCount($table_count, $connection->schema()->findTables('%'), 'No additional tables created in the database'); } /** * @coversNothing */ public function testInstallScript() { - $phpBinaryFinder = new PhpExecutableFinder(); - $phpBinaryPath = $phpBinaryFinder->find(); + $php_binary_finder = new PhpExecutableFinder(); + $php_inary_path = $php_binary_finder->find(); // Install a site using the JSON output. - $command_line = $phpBinaryPath . ' core/scripts/test-site.php install --json --setup_class "' . TestSiteInstallTestScript::class . '" --db_url "' . getenv('SIMPLETEST_DB') . '"'; + $command_line = $php_inary_path . ' core/scripts/test-site.php install --json --setup_class "' . TestSiteInstallTestScript::class . '" --db_url "' . getenv('SIMPLETEST_DB') . '"'; $process = new Process($command_line, $this->root); // Set the timeout to a value that allows debugging. $process->setTimeout(500); @@ -113,7 +113,7 @@ public function testInstallScript() { // Install another site so we can ensure tear down only removes one site at // a time. Use the regular output. - $command_line = $phpBinaryPath . ' core/scripts/test-site.php install --setup_class "' . TestSiteInstallTestScript::class . '" --db_url "' . getenv('SIMPLETEST_DB') . '"'; + $command_line = $php_inary_path . ' core/scripts/test-site.php install --setup_class "' . TestSiteInstallTestScript::class . '" --db_url "' . getenv('SIMPLETEST_DB') . '"'; $process = new Process($command_line, $this->root); // Set the timeout to a value that allows debugging. $process->setTimeout(500); @@ -128,7 +128,7 @@ public function testInstallScript() { $this->assertGreaterThan(0, count(Database::getConnection('default', $other_key)->schema()->findTables('%'))); // Now test the tear down process as well. - $command_line = $phpBinaryPath . ' core/scripts/test-site.php tear-down ' . $db_prefix . ' --db_url "' . getenv('SIMPLETEST_DB') . '"'; + $command_line = $php_inary_path . ' core/scripts/test-site.php tear-down ' . $db_prefix . ' --db_url "' . getenv('SIMPLETEST_DB') . '"'; $process = new Process($command_line, $this->root); // Set the timeout to a value that allows debugging. $process->setTimeout(500); @@ -147,7 +147,7 @@ public function testInstallScript() { $this->assertFileExists($test_file); // Tear down the other site installed. - $command_line = $phpBinaryPath . ' core/scripts/test-site.php tear-down ' . $other_db_prefix . ' --db_url "' . getenv('SIMPLETEST_DB') . '"'; + $command_line = $php_inary_path . ' core/scripts/test-site.php tear-down ' . $other_db_prefix . ' --db_url "' . getenv('SIMPLETEST_DB') . '"'; $process = new Process($command_line, $this->root); // Set the timeout to a value that allows debugging. $process->setTimeout(500); @@ -164,10 +164,10 @@ public function testInstallScript() { * @coversNothing */ public function testInstallInDifferentLanguage() { - $phpBinaryFinder = new PhpExecutableFinder(); - $phpBinaryPath = $phpBinaryFinder->find(); + $php_binary_finder = new PhpExecutableFinder(); + $php_binary_path = $php_binary_finder->find(); - $command_line = $phpBinaryPath . ' core/scripts/test-site.php install --json --langcode fr --setup_class "' . TestSiteInstallTestScript::class . '" --db_url "' . getenv('SIMPLETEST_DB') . '"'; + $command_line = $php_binary_path . ' core/scripts/test-site.php install --json --langcode fr --setup_class "' . TestSiteInstallTestScript::class . '" --db_url "' . getenv('SIMPLETEST_DB') . '"'; $process = new Process($command_line, $this->root); $process->setTimeout(500); $process->run(); @@ -185,7 +185,7 @@ public function testInstallInDifferentLanguage() { $this->assertContains('lang="fr"', (string) $response->getBody()); // Now test the tear down process as well. - $command_line = $phpBinaryPath . ' core/scripts/test-site.php tear-down ' . $db_prefix . ' --db_url "' . getenv('SIMPLETEST_DB') . '"'; + $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); $process->setTimeout(500); $process->run(); @@ -198,7 +198,7 @@ public function testInstallInDifferentLanguage() { /** * Adds the installed test site to the database connection info. * - * @param $db_prefix + * @param string $db_prefix * The prefix of the installed test site. * * @return string