function system_test_modules_installed

Same name in other branches
  1. 7.x modules/simpletest/tests/system_test.module \system_test_modules_installed()
  2. 9 core/modules/system/tests/modules/system_test/system_test.module \system_test_modules_installed()
  3. 10 core/modules/system/tests/modules/system_test/system_test.module \system_test_modules_installed()
  4. 11.x core/modules/system/tests/modules/system_test/system_test.module \system_test_modules_installed()

Implements hook_modules_installed().

File

core/modules/system/tests/modules/system_test/system_test.module, line 29

Code

function system_test_modules_installed($modules) {
    if (\Drupal::state()->get('system_test.verbose_module_hooks')) {
        foreach ($modules as $module) {
            \Drupal::messenger()->addStatus(t('hook_modules_installed fired for @module', [
                '@module' => $module,
            ]));
        }
    }
    if (\Drupal::state()->get('system_test.path_alias_save') && in_array('path_alias', $modules)) {
        try {
            $path_alias = PathAlias::create([
                'path' => '/user',
                'alias' => '/test',
            ]);
            $path_alias->save();
        } catch (EntityStorageException $e) {
            $root_exception = $e->getPrevious() ?: $e;
            \Drupal::state()->set('system_test.path_alias_save_exception_thrown', [
                'class' => get_class($root_exception),
                'message' => $root_exception->getMessage(),
            ]);
        }
    }
}

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