class PhpRequirementsTest extends UnitTestCase
{ /**
* Ensures that PHP EOL dates are valid.
*
* This ensures that that all of the PHP EOL Date items are valid ISO 8601
* dates and are keyed by a valid version number.
*/
public function testPhpEolDates(): void
{ $reflected =
new \
ReflectionClass(PhpRequirements::
class);
$php_eol_dates =
$reflected->
getStaticPropertyValue('phpEolDates'
);
foreach ($php_eol_dates as $version =>
$eol_date) { // Ensure that all of the version numbers are defined in a superset of
// semver: 'major.minor.patch-modifier', where (unlike in semver) all
// parts but the major are optional.
// @see version_compare()
$this->
assertMatchesRegularExpression('/^([0-9]+)(\.([0-9]+)(\.([0-9]+)(-[A-Za-z0-9]+)?)?)?$/',
$version);
// Ensure that all of the EOL dates are defined using ISO 8601 format.
$this->
assertMatchesRegularExpression('/^([0-9]{4})-(1[0-2]|0[1-9])-(3[01]|0[1-9]|[12][0-9])$/',
$eol_date);
}