new_dependency_test.install

Same filename in other branches
  1. 9 core/modules/system/tests/modules/new_dependency_test/new_dependency_test.install
  2. 8.9.x core/modules/system/tests/modules/new_dependency_test/new_dependency_test.install
  3. 10 core/modules/system/tests/modules/new_dependency_test/new_dependency_test.install

File

core/modules/system/tests/modules/new_dependency_test/new_dependency_test.install

View source
<?php


/**
 * @file
 * Install, update and uninstall functions for the new_dependency_test module.
 */
declare (strict_types=1);

/**
 * Enable the new_dependency_test_with_service module.
 */
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);
}

Functions

Title Deprecated Summary
new_dependency_test_update_8001 Enable the new_dependency_test_with_service module.

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