public function QuickStartTest::testPhpRequirement in Drupal 9
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/Core/Command/QuickStartTest.php \Drupal\Tests\Core\Command\QuickStartTest::testPhpRequirement()
Tests that the installer throws a requirement error on older PHP versions.
File
- core/
tests/ Drupal/ Tests/ Core/ Command/ QuickStartTest.php, line 145
Class
- QuickStartTest
- Tests the quick-start commands.
Namespace
Drupal\Tests\Core\CommandCode
public function testPhpRequirement() {
if (version_compare(phpversion(), \Drupal::MINIMUM_SUPPORTED_PHP) >= 0) {
$this
->markTestSkipped();
}
$install_command = [
$this->php,
'core/scripts/drupal',
'quick-start',
'standard',
"--site-name='Test site {$this->testDb->getDatabasePrefix()}'",
'--suppress-login',
];
$process = new Process($install_command, NULL, [
'DRUPAL_DEV_SITE_PATH' => $this->testDb
->getTestSitePath(),
]);
$process
->setTimeout(500);
$process
->start();
while ($process
->isRunning()) {
// Wait for more output.
sleep(1);
}
$error_output = $process
->getErrorOutput();
$this
->assertStringContainsString('Your PHP installation is too old.', $error_output);
$this
->assertStringContainsString('Drupal requires at least PHP', $error_output);
$this
->assertStringContainsString(\Drupal::MINIMUM_SUPPORTED_PHP, $error_output);
// Stop the web server.
$process
->stop();
}