You are here

public function SupportedPhpVersionTest::testSupportedPhpVersion in Automatic Updates 8

Tests the functionality of supported PHP version readiness checks.

File

tests/src/Kernel/ReadinessChecker/SupportedPhpVersionTest.php, line 26

Class

SupportedPhpVersionTest
Tests supported PHP version readiness checking.

Namespace

Drupal\Tests\automatic_updates\Kernel\ReadinessChecker

Code

public function testSupportedPhpVersion() {

  // No unsupported PHP versions.
  $services = [
    'automatic_updates.minimum_php_version',
    'automatic_updates.blacklist_php_72',
  ];
  foreach ($services as $service) {
    $messages = $this->container
      ->get($service)
      ->run();
    $this
      ->assertEmpty($messages);
  }
  $this
    ->assertNotEmpty($services);

  // Unsupported versions.
  $messages = (new TestBlacklistPhp72Versions())
    ->run();
  self::assertEquals('PHP 7.2.0, 7.2.1 and 7.2.2 have issues with opcache that breaks signature validation. Please upgrade to a newer version of PHP to ensure assurance and security for package signing.', $messages[0]);
  $messages = (new TestMinimumPhpVersion())
    ->run();
  self::assertEquals('This site is running on an unsupported version of PHP. It cannot be updated. Please update to at least PHP 7.0.8.', $messages[0]);
}