function PhpRequirementsTest::testMinimumSupportedPhp
Same name in other branches
- 10 core/tests/Drupal/Tests/Core/Utility/PhpRequirementsTest.php \Drupal\Tests\Core\Utility\PhpRequirementsTest::testMinimumSupportedPhp()
- 11.x core/tests/Drupal/Tests/Core/Utility/PhpRequirementsTest.php \Drupal\Tests\Core\Utility\PhpRequirementsTest::testMinimumSupportedPhp()
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);
$prop = $reflected->getProperty('drupalMinimumPhp');
$prop->setAccessible(TRUE);
$prop->setValue($drupal_minimum_php);
$prop = $reflected->getProperty('phpEolDates');
$prop->setAccessible(TRUE);
$prop->setValue($php_eol_dates);
$date = new \DateTime($date_string);
$this->assertSame($expected_php_version, PhpRequirements::getMinimumSupportedPhp($date));
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.