Skip to content
Snippets Groups Projects
Commit fbf951e8 authored by catch's avatar catch
Browse files

Issue #3265291 by xjm, neclimdul, longwave, Spokje: QuickStartTest: The waiting is the hardest part

(cherry picked from commit c97eb132)
parent db4c9ef9
Branches
Tags
9 merge requests!2496Issue #3222757 by lauriii, Wim Leers, nod_, rachel_norfolk, itmaybejj,...,!2366Issue #3285105 by Daniel Arend,!2304Issue #3258987: Class "Drupal\Core\Utility\Error" not found in _drupal_error_handler_real() due to bug in PHP 8.1.0-8.1.5,!2148Issue #3270899: Remove Color module from core,!2071Issue #927570: Setting 403 or 404 handler to a page that redirects leads to endless loop,!1975Issue #3269749: losing query params from user to user/login redirect,!1387Draft: Resolve #2511878 "Support enclosure field",!799Issue #3214332: Preview content is broken in Claro.,!558Resolve #3020422 "Toolbar style update"
...@@ -108,14 +108,12 @@ public function testQuickStartCommand() { ...@@ -108,14 +108,12 @@ public function testQuickStartCommand() {
$process->start(); $process->start();
$guzzle = new Client(); $guzzle = new Client();
$port = FALSE; $port = FALSE;
while ($process->isRunning()) { $process->waitUntil(function ($type, $output) use (&$port) {
if (preg_match('/127.0.0.1:(\d+)/', $process->getOutput(), $match)) { if (preg_match('/127.0.0.1:(\d+)/', $output, $match)) {
$port = $match[1]; $port = $match[1];
break; return TRUE;
}
// Wait for more output.
sleep(1);
} }
});
// The progress bar uses STDERR to write messages. // The progress bar uses STDERR to write messages.
$this->assertStringContainsString('Congratulations, you installed Drupal!', $process->getErrorOutput()); $this->assertStringContainsString('Congratulations, you installed Drupal!', $process->getErrorOutput());
$this->assertNotFalse($port, "Web server running on port $port"); $this->assertNotFalse($port, "Web server running on port $port");
...@@ -157,12 +155,7 @@ public function testPhpRequirement() { ...@@ -157,12 +155,7 @@ public function testPhpRequirement() {
]; ];
$process = new Process($install_command, NULL, ['DRUPAL_DEV_SITE_PATH' => $this->testDb->getTestSitePath()]); $process = new Process($install_command, NULL, ['DRUPAL_DEV_SITE_PATH' => $this->testDb->getTestSitePath()]);
$process->setTimeout(500); $process->setTimeout(500);
$process->start(); $process->run();
while ($process->isRunning()) {
// Wait for more output.
sleep(1);
}
$error_output = $process->getErrorOutput(); $error_output = $process->getErrorOutput();
$this->assertStringContainsString('Your PHP installation is too old.', $error_output); $this->assertStringContainsString('Your PHP installation is too old.', $error_output);
$this->assertStringContainsString('Drupal requires at least PHP', $error_output); $this->assertStringContainsString('Drupal requires at least PHP', $error_output);
...@@ -209,14 +202,12 @@ public function testQuickStartInstallAndServerCommands() { ...@@ -209,14 +202,12 @@ public function testQuickStartInstallAndServerCommands() {
$server_process->start(); $server_process->start();
$guzzle = new Client(); $guzzle = new Client();
$port = FALSE; $port = FALSE;
while ($server_process->isRunning()) { $server_process->waitUntil(function ($type, $output) use (&$port) {
if (preg_match('/127.0.0.1:(\d+)/', $server_process->getOutput(), $match)) { if (preg_match('/127.0.0.1:(\d+)\/user\/reset\/1\//', $output, $match)) {
$port = $match[1]; $port = $match[1];
break; return TRUE;
}
// Wait for more output.
sleep(1);
} }
});
$this->assertEquals('', $server_process->getErrorOutput()); $this->assertEquals('', $server_process->getErrorOutput());
$this->assertStringContainsString("127.0.0.1:$port/user/reset/1/", $server_process->getOutput()); $this->assertStringContainsString("127.0.0.1:$port/user/reset/1/", $server_process->getOutput());
$this->assertNotFalse($port, "Web server running on port $port"); $this->assertNotFalse($port, "Web server running on port $port");
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment