function DependencyOrderingTest::testUpdateOrderingModuleInterdependency

Same name in other branches
  1. 9 core/modules/system/tests/src/Functional/UpdateSystem/DependencyOrderingTest.php \Drupal\Tests\system\Functional\UpdateSystem\DependencyOrderingTest::testUpdateOrderingModuleInterdependency()
  2. 8.9.x core/modules/system/tests/src/Functional/UpdateSystem/DependencyOrderingTest.php \Drupal\Tests\system\Functional\UpdateSystem\DependencyOrderingTest::testUpdateOrderingModuleInterdependency()
  3. 11.x core/modules/system/tests/src/Functional/UpdateSystem/DependencyOrderingTest.php \Drupal\Tests\system\Functional\UpdateSystem\DependencyOrderingTest::testUpdateOrderingModuleInterdependency()

Tests that dependencies between modules are resolved correctly.

File

core/modules/system/tests/src/Functional/UpdateSystem/DependencyOrderingTest.php, line 58

Class

DependencyOrderingTest
Tests that update functions are run in the proper order.

Namespace

Drupal\Tests\system\Functional\UpdateSystem

Code

public function testUpdateOrderingModuleInterdependency() : void {
    $starting_updates = [
        'update_test_2' => 8001,
        'update_test_3' => 8001,
    ];
    $update_order = array_keys(update_resolve_dependencies($starting_updates));
    // Make sure that each dependency is satisfied.
    $first_dependency_satisfied = array_search('update_test_2_update_8001', $update_order) < array_search('update_test_3_update_8001', $update_order);
    $this->assertTrue($first_dependency_satisfied, 'The dependency of the second module on the first module is respected by the update function order.');
    $second_dependency_satisfied = array_search('update_test_3_update_8001', $update_order) < array_search('update_test_2_update_8002', $update_order);
    $this->assertTrue($second_dependency_satisfied, 'The dependency of the first module on the second module is respected by the update function order.');
}

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