function EquivalentUpdateTest::testAttributeOnInstall

Same name and namespace in other branches
  1. main core/modules/system/tests/src/Functional/UpdateSystem/EquivalentUpdateTest.php \Drupal\Tests\system\Functional\UpdateSystem\EquivalentUpdateTest::testAttributeOnInstall()

Tests MarkFutureUpdateEquivalent attribute functionality on module install.

File

core/modules/system/tests/src/Functional/UpdateSystem/EquivalentUpdateTest.php, line 242

Class

EquivalentUpdateTest
Tests that update hooks are properly run.

Namespace

Drupal\Tests\system\Functional\UpdateSystem

Code

public function testAttributeOnInstall() : void {
  // Test an update function with the MarkFutureUpdateEquivalent attribute
  // registers on module install.
  \Drupal::service(ModuleInstallerInterface::class)->install([
    'equivalent_update_test_attribute_install',
  ]);
  /** @var \Drupal\Core\Update\UpdateHookRegistry $update_registry */
  $update_registry = \Drupal::service(UpdateHookRegistry::class);
  $this->assertEquals(100001, $update_registry->getInstalledVersion('equivalent_update_test_attribute_install'));
  $equivalent_update = $update_registry->getEquivalentUpdate('equivalent_update_test_attribute_install', 110001);
  $this->assertSame(100001, $equivalent_update->ran_update);
  $this->assertSame('11.0.0', $equivalent_update->future_version);
}

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