You are here

function UpdateDependencyOrderingTestCase::testUpdateOrderingModuleInterdependency in Drupal 7

Test that dependencies between modules are resolved correctly.

File

modules/simpletest/tests/update.test, line 44
Tests for the update system.

Class

UpdateDependencyOrderingTestCase
Tests for the update dependency ordering system.

Code

function testUpdateOrderingModuleInterdependency() {
  $starting_updates = array(
    'update_test_2' => 7000,
    'update_test_3' => 7000,
  );
  $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_7000', $update_order) < array_search('update_test_3_update_7000', $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_7000', $update_order) < array_search('update_test_2_update_7001', $update_order);
  $this
    ->assertTrue($second_dependency_satisfied, 'The dependency of the first module on the second module is respected by the update function order.');
}