public function PhpRequirementsTest::testMinimumSupportedPhp in Drupal 10
Tests the minimum supported PHP for valid scenarios.
@covers ::getMinimumSupportedPhp
@dataProvider providerMinimumSupportedPhp
Parameters
string $date_string: A valid PHP date string for the date to check.
string $drupal_minimum_php: The PHP minimum version hard requirement for the Drupal version, below which Drupal cannot be installed or updated, typically \Drupal::MINIMUM_PHP.
string[] $php_eol_dates: Associative array of PHP version EOL date strings, keyed by the PHP minor version.
string $expected_php_version: The PHP version the test should recommend.
File
- core/
tests/ Drupal/ Tests/ Core/ Utility/ PhpRequirementsTest.php, line 70
Class
- PhpRequirementsTest
- Tests the \Drupal\Core\Utility\PhpRequirements class.
Namespace
Drupal\Tests\Core\UtilityCode
public function testMinimumSupportedPhp(string $date_string, string $drupal_minimum_php, array $php_eol_dates, string $expected_php_version) : void {
$reflected = new \ReflectionClass(PhpRequirements::class);
$reflected
->setStaticPropertyValue('drupalMinimumPhp', $drupal_minimum_php);
$reflected
->setStaticPropertyValue('phpEolDates', $php_eol_dates);
$date = new \DateTime($date_string);
$this
->assertSame($expected_php_version, PhpRequirements::getMinimumSupportedPhp($date));
}