diff --git a/core/scripts/setup-drupal-test.php b/core/scripts/setup-drupal-test.php index 94e6b9c2d3..304e0377c1 100644 --- a/core/scripts/setup-drupal-test.php +++ b/core/scripts/setup-drupal-test.php @@ -16,6 +16,5 @@ $autoloader = require __DIR__ . '/../../autoload.php'; require_once __DIR__ . '/../tests/bootstrap.php'; -$app = new TestInstallationSetupApplication(); -$app->setAutoloader($autoloader); +$app = new TestInstallationSetupApplication($autoloader); $app->run(); diff --git a/core/tests/Drupal/Setup/Commands/TestInstallationSetupApplication.php b/core/tests/Drupal/Setup/Commands/TestInstallationSetupApplication.php index 09761e00b0..e044c4ffda 100644 --- a/core/tests/Drupal/Setup/Commands/TestInstallationSetupApplication.php +++ b/core/tests/Drupal/Setup/Commands/TestInstallationSetupApplication.php @@ -12,14 +12,22 @@ */ class TestInstallationSetupApplication extends Application { + /** + * The used PHP autoloader. + * + * @var object + */ protected $autoloader; /** * SetupDrupalApplication constructor. + * + * @param string $autoloader + * The used PHP autoloader. */ public function __construct($autoloader) { parent::__construct('setup-drupal-test', '0.0.1'); - $this->setAutoloader($autoloader); + $this->autoloader = $autoloader; } /** @@ -35,17 +43,8 @@ protected function getCommandName(InputInterface $input) { protected function getDefaultCommands() { // Even though this is a single command, keep the HelpCommand (--help). $default_commands = parent::getDefaultCommands(); - $default_commands[] = new TestInstallationSetupCommand(); + $default_commands[] = new TestInstallationSetupCommand($this->autoloader); return $default_commands; } - public function setAutoloader($autoloader) { - $this->autoloader = $autoloader; - return $this; - } - - public function getAutoloader() { - return $this->autoloader; - } - } diff --git a/core/tests/Drupal/Setup/Commands/TestInstallationSetupCommand.php b/core/tests/Drupal/Setup/Commands/TestInstallationSetupCommand.php index 8e81737a69..9c0cbfe15d 100644 --- a/core/tests/Drupal/Setup/Commands/TestInstallationSetupCommand.php +++ b/core/tests/Drupal/Setup/Commands/TestInstallationSetupCommand.php @@ -18,6 +18,28 @@ */ class TestInstallationSetupCommand extends Command { + /** + * The used PHP autoloader. + * + * @var object + */ + protected $autoloader; + + /** + * Constructs a new TestInstallationSetupCommand. + * + * @param string $autoloader + * The used PHP autoloader. + * @param string|null $name + * The name of the command. Passing NULL means it must be set in + * configure(). + */ + public function __construct($autoloader, $name = NULL) { + parent::__construct($name); + + $this->autoloader = $autoloader; + } + /** * {@inheritdoc} */ @@ -37,7 +59,7 @@ protected function execute(InputInterface $input, OutputInterface $output) { putenv("SIMPLETEST_DB=$db_url"); putenv("SIMPLETEST_BASE_URL=$base_url"); - $this->bootstrapDrupal($this->getApplication()->getAutoloader()); + $this->bootstrapDrupal($this->autoloader); // Manage site fixture. $test = new TestInstallationSetup();