function PendingUpdatesValidatorTest::testPendingUpdateAfterStaged

Tests that pending updates stop an operation from being applied.

File

core/modules/package_manager/tests/src/Kernel/PendingUpdatesValidatorTest.php, line 80

Class

PendingUpdatesValidatorTest
Tests Pending Updates Validator.

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testPendingUpdateAfterStaged() : void {
  $stage = $this->createStage();
  $stage->create();
  $stage->require([
    'drupal/core:9.8.1',
  ]);
  // Make an additional post-update function available; the update registry
  // will think it's pending.
  require_once __DIR__ . '/../../fixtures/post_update.php';
  $result = ValidationResult::createError([
    $this->t('Some modules have database updates pending. You should run the <a href="/update.php">database update script</a> immediately.'),
  ]);
  try {
    $stage->apply();
    $this->fail('Able to apply update even though there is pending update.');
  } catch (SandboxEventException $exception) {
    $this->assertExpectedResultsFromException([
      $result,
    ], $exception);
  }
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.