function new_dependency_test_update_8001

Same name and namespace in other branches
  1. 9 core/modules/system/tests/modules/new_dependency_test/new_dependency_test.install \new_dependency_test_update_8001()
  2. 8.9.x core/modules/system/tests/modules/new_dependency_test/new_dependency_test.install \new_dependency_test_update_8001()
  3. 11.x core/modules/system/tests/modules/new_dependency_test/new_dependency_test.install \new_dependency_test_update_8001()

Enable the new_dependency_test_with_service module.

File

core/modules/system/tests/modules/new_dependency_test/new_dependency_test.install, line 11

Code

function new_dependency_test_update_8001() {
    $services = [
        'new_dependency_test.hard_dependency',
        'new_dependency_test.optional_dependency',
        'new_dependency_test.recursion',
        'new_dependency_test.alias',
        'new_dependency_test.alias_dependency',
        'new_dependency_test.alias2',
        'new_dependency_test.alias_dependency2',
        'new_dependency_test.setter_injection',
    ];
    // Gather the state of the services prior to installing the
    // new_dependency_test_with_service module.
    \Drupal::state()->set('new_dependency_test_update_8001.decorated_service', \Drupal::service('new_dependency_test.another_service')->isDecorated());
    \Drupal::state()->set('new_dependency_test_update_8001.decorated_service_custom_inner', \Drupal::service('new_dependency_test.another_service_two')->isDecorated());
    $map = [];
    foreach ($services as $id) {
        $map[$id] = \Drupal::hasService($id);
    }
    \Drupal::state()->set('new_dependency_test_update_8001.has_before_install', $map);
    // During the update hooks the container is cleaned up to contain only
    // services that have their dependencies met. Core services are available.
    \Drupal::getContainer()->get('module_installer')
        ->install([
        'new_dependency_test_with_service',
    ]);
    // Gather the state of the services after installing the
    // new_dependency_test_with_service module.
    $map = [];
    foreach ($services as $id) {
        $map[$id] = \Drupal::hasService($id);
    }
    \Drupal::state()->set('new_dependency_test_update_8001.has_after_install', $map);
}

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