Skip to content

Commit 5ebb2dc

Browse files
committed
Issue #3020550 by catch: Passing commands as a string to Process is deprecated in Symfony 4
(cherry picked from commit b4297ad)
1 parent 11a1071 commit 5ebb2dc

File tree

1 file changed

+42
-6
lines changed

1 file changed

+42
-6
lines changed

tests/Drupal/Tests/Core/Command/QuickStartTest.php

Lines changed: 42 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,15 @@ public function tearDown() {
8585
public function testQuickStartCommand() {
8686
// Install a site using the standard profile to ensure the one time login
8787
// link generation works.
88-
$install_command = "{$this->php} core/scripts/drupal quick-start standard --site-name='Test site {$this->testDb->getDatabasePrefix()}' --suppress-login";
88+
89+
$install_command = [
90+
$this->php,
91+
'core/scripts/drupal',
92+
'quick-start',
93+
'standard',
94+
"--site-name='Test site {$this->testDb->getDatabasePrefix()}'",
95+
'--suppress-login',
96+
];
8997
$process = new Process($install_command, NULL, ['DRUPAL_DEV_SITE_PATH' => $this->testDb->getTestSitePath()]);
9098
$process->inheritEnvironmentVariables();
9199
$process->setTimeout(500);
@@ -129,7 +137,13 @@ public function testQuickStartCommand() {
129137
*/
130138
public function testQuickStartInstallAndServerCommands() {
131139
// Install a site.
132-
$install_command = "{$this->php} core/scripts/drupal install testing --site-name='Test site {$this->testDb->getDatabasePrefix()}'";
140+
$install_command = [
141+
$this->php,
142+
'core/scripts/drupal',
143+
'install',
144+
'testing',
145+
"--site-name='Test site {$this->testDb->getDatabasePrefix()}'",
146+
];
133147
$install_process = new Process($install_command, NULL, ['DRUPAL_DEV_SITE_PATH' => $this->testDb->getTestSitePath()]);
134148
$install_process->inheritEnvironmentVariables();
135149
$install_process->setTimeout(500);
@@ -139,7 +153,12 @@ public function testQuickStartInstallAndServerCommands() {
139153
$this->assertSame(0, $result);
140154

141155
// Run the PHP built-in webserver.
142-
$server_command = "{$this->php} core/scripts/drupal server --suppress-login";
156+
$server_command = [
157+
$this->php,
158+
'core/scripts/drupal',
159+
'server',
160+
'--suppress-login',
161+
];
143162
$server_process = new Process($server_command, NULL, ['DRUPAL_DEV_SITE_PATH' => $this->testDb->getTestSitePath()]);
144163
$server_process->inheritEnvironmentVariables();
145164
$server_process->start();
@@ -173,7 +192,13 @@ public function testQuickStartInstallAndServerCommands() {
173192
$this->assertContains('Test site ' . $this->testDb->getDatabasePrefix(), $content);
174193

175194
// Try to re-install over the top of an existing site.
176-
$install_command = "{$this->php} core/scripts/drupal install testing --site-name='Test another site {$this->testDb->getDatabasePrefix()}'";
195+
$install_command = [
196+
$this->php,
197+
'core/scripts/drupal',
198+
'install',
199+
'testing',
200+
"--site-name='Test another site {$this->testDb->getDatabasePrefix()}'",
201+
];
177202
$install_process = new Process($install_command, NULL, ['DRUPAL_DEV_SITE_PATH' => $this->testDb->getTestSitePath()]);
178203
$install_process->inheritEnvironmentVariables();
179204
$install_process->setTimeout(500);
@@ -196,7 +221,13 @@ public function testQuickStartInstallAndServerCommands() {
196221
public function testQuickStartCommandProfileValidation() {
197222
// Install a site using the standard profile to ensure the one time login
198223
// link generation works.
199-
$install_command = "{$this->php} core/scripts/drupal quick-start umami --site-name='Test site {$this->testDb->getDatabasePrefix()}' --suppress-login";
224+
$install_command = [
225+
$this->php,
226+
'core/scripts/drupal',
227+
'quick-start',
228+
'umami',
229+
"--site-name='Test site {$this->testDb->getDatabasePrefix()}' --suppress-login",
230+
];
200231
$process = new Process($install_command, NULL, ['DRUPAL_DEV_SITE_PATH' => $this->testDb->getTestSitePath()]);
201232
$process->inheritEnvironmentVariables();
202233
$process->run();
@@ -207,7 +238,12 @@ public function testQuickStartCommandProfileValidation() {
207238
* Tests the server command when there is no installation.
208239
*/
209240
public function testServerWithNoInstall() {
210-
$server_command = "{$this->php} core/scripts/drupal server --suppress-login";
241+
$server_command = [
242+
$this->php,
243+
'core/scripts/drupal',
244+
'server',
245+
'--suppress-login',
246+
];
211247
$server_process = new Process($server_command, NULL, ['DRUPAL_DEV_SITE_PATH' => $this->testDb->getTestSitePath()]);
212248
$server_process->inheritEnvironmentVariables();
213249
$server_process->run();

0 commit comments

Comments
 (0)