You are here

protected function RangeUpdatePathTest::setUp in Range 8

Overrides WebTestBase::setUp() for update testing.

The main difference in this method is that rather than performing the installation via the installer, a database is loaded. Additional work is then needed to set various things such as the config directories and the container that would normally be done via the installer.

Overrides UpdatePathTestBase::setUp

File

tests/src/Functional/Update/RangeUpdatePathTest.php, line 20

Class

RangeUpdatePathTest
Tests range module update path.

Namespace

Drupal\Tests\range\Functional\Update

Code

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

  // Ensure that range fields are marked as installed. This cannot be done
  // easily in the database dump file.
  $definitions = \Drupal::service('entity.last_installed_schema.repository')
    ->getLastInstalledFieldStorageDefinitions('node');
  $definitions['field_decimal'] = FieldStorageConfig::load('node.field_decimal');
  $definitions['field_float'] = FieldStorageConfig::load('node.field_float');
  $definitions['field_integer'] = FieldStorageConfig::load('node.field_integer');
  \Drupal::service('entity.last_installed_schema.repository')
    ->setLastInstalledFieldStorageDefinitions('node', $definitions);
}