You are here

public function PhpSapiTest::testPhpSapiChanges in Automatic Updates 8

Tests PHP SAPI changes.

File

tests/src/Kernel/ReadinessChecker/PhpSapiTest.php, line 24

Class

PhpSapiTest
Tests what happens when PHP SAPI changes from one value to another.

Namespace

Drupal\Tests\automatic_updates\Kernel\ReadinessChecker

Code

public function testPhpSapiChanges() {
  $messages = $this->container
    ->get('automatic_updates.php_sapi')
    ->run();
  $this
    ->assertEmpty($messages);
  $messages = $this->container
    ->get('automatic_updates.php_sapi')
    ->run();
  $this
    ->assertEmpty($messages);
  $this->container
    ->get('state')
    ->set('automatic_updates.php_sapi', 'foo');
  $messages = $this->container
    ->get('automatic_updates.php_sapi')
    ->run();
  self::assertEquals('PHP changed from running as "foo" to "cli". This can lead to inconsistent and misleading results.', $messages[0]);
}