function UpdateOrderingTest::testUpdateOrderingWithDependencyChain

Tests update ordering with a dependency chain.

File

core/tests/Drupal/Tests/Core/Update/UpdateOrderingTest.php, line 98

Class

UpdateOrderingTest
Tests update ordering.

Namespace

Drupal\Tests\Core\Update

Code

public function testUpdateOrderingWithDependencyChain() : void {
  // Indicate that the z_module_update_9000() function must run before the
  // a_module_update_9000() function.
  static::$updateDependenciesHookReturn['a_module'][9000] = [
    'z_module' => 9000,
  ];
  // Indicate that the a_module_update_9000() function must run before the
  // system_update_9000() function.
  static::$updateDependenciesHookReturn['system'][9000] = [
    'a_module' => 9000,
  ];
  $updates = update_resolve_dependencies([
    'a_module' => 9000,
    'system' => '9000',
    'z_module' => 9000,
  ]);
  $this->assertSame([
    'z_module_update_9000',
    'a_module_update_9000',
    'system_update_9000',
    'system_update_9001',
    'z_module_update_9001',
  ], array_keys($updates));
}

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