You are here

public function DependencyHookInvocationTest::testHookUpdateDependencies in Drupal 8

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

Test the structure of the array returned by hook_update_dependencies().

File

core/modules/system/tests/src/Functional/UpdateSystem/DependencyHookInvocationTest.php, line 35

Class

DependencyHookInvocationTest
Tests that the hook invocation for determining update dependencies works correctly.

Namespace

Drupal\Tests\system\Functional\UpdateSystem

Code

public function testHookUpdateDependencies() {
  $update_dependencies = update_retrieve_dependencies();
  $this
    ->assertTrue($update_dependencies['update_test_0'][8001]['update_test_1'] == 8001, 'An update function that has a dependency on two separate modules has the first dependency recorded correctly.');
  $this
    ->assertTrue($update_dependencies['update_test_0'][8001]['update_test_2'] == 8002, 'An update function that has a dependency on two separate modules has the second dependency recorded correctly.');
  $this
    ->assertTrue($update_dependencies['update_test_0'][8002]['update_test_1'] == 8003, 'An update function that depends on more than one update from the same module only has the dependency on the higher-numbered update function recorded.');
}