function PendingUpdatesValidatorTest::testPendingUpdateHook

Tests that an error is raised if there are pending schema updates.

@depends testNoPendingUpdates

File

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

Class

PendingUpdatesValidatorTest
@covers \Drupal\package_manager\Validator\PendingUpdatesValidator @group package_manager @internal

Namespace

Drupal\Tests\package_manager\Kernel

Code

public function testPendingUpdateHook() : void {
    // Set the installed schema version of Package Manager to its default value
    // and import an empty update hook which is numbered much higher than will
    // ever exist in the real world.
    $this->container
        ->get('keyvalue')
        ->get('system.schema')
        ->set('package_manager', \Drupal::CORE_MINIMUM_SCHEMA_VERSION);
    require_once __DIR__ . '/../../fixtures/db_update.php';
    $result = ValidationResult::createError([
        t('Some modules have database updates pending. You should run the <a href="/update.php">database update script</a> immediately.'),
    ]);
    $this->assertStatusCheckResults([
        $result,
    ]);
    $this->assertResults([
        $result,
    ], PreCreateEvent::class);
}

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