You are here

protected function AutomaticUpdatesKernelTestBase::setUp in Automatic Updates 8.2

Overrides KernelTestBase::setUp

1 call to AutomaticUpdatesKernelTestBase::setUp()
ReadinessValidationManagerTest::setUp in tests/src/Kernel/ReadinessValidation/ReadinessValidationManagerTest.php
1 method overrides AutomaticUpdatesKernelTestBase::setUp()
ReadinessValidationManagerTest::setUp in tests/src/Kernel/ReadinessValidation/ReadinessValidationManagerTest.php

File

tests/src/Kernel/AutomaticUpdatesKernelTestBase.php, line 41

Class

AutomaticUpdatesKernelTestBase
Base class for kernel tests of the Automatic Updates module.

Namespace

Drupal\Tests\automatic_updates\Kernel

Code

protected function setUp() : void {
  parent::setUp();

  // The Update module's default configuration must be installed for our
  // fake release metadata to be fetched.
  $this
    ->installConfig('update');

  // Make the update system think that all of System's post-update functions
  // have run. Since kernel tests don't normally install modules and register
  // their updates, we need to do this so that all validators are tested from
  // a clean, fully up-to-date state.
  $updates = $this->container
    ->get('update.post_update_registry')
    ->getPendingUpdateFunctions();
  $this->container
    ->get('keyvalue')
    ->get('post_update')
    ->set('existing_updates', $updates);

  // By default, pretend we're running Drupal core 9.8.0 and a non-security
  // update to 9.8.1 is available.
  $this
    ->setCoreVersion('9.8.0');
  $this
    ->setReleaseMetadata(__DIR__ . '/../../fixtures/release-history/drupal.9.8.1.xml');
}