function ClassLoaderTest::testSystemRegisterDeprecation

@expectedDeprecation system_register() is deprecated in Drupal 8.8.0 and will be removed before Drupal 9.0.0. There is no replacement for this function. To achieve the same functionality use this snippet: $path = \Drupal::service("extension.list.$type")->getPath($name); \Drupal::service('class_loader')->addPsr4('Drupal\\' . $name . '\\', \Drupal::root() . '/' . $path . '/src'); See https://www.drupal.org/node/3035275.

See also

system_register()

File

core/tests/Drupal/Tests/Core/ClassLoader/ClassLoaderTest.php, line 42

Class

ClassLoaderTest
@group ClassLoader @group legacy @runTestsInSeparateProcesses

Namespace

Drupal\Tests\Core\ClassLoader

Code

public function testSystemRegisterDeprecation() {
    include_once $this->root . '/core/includes/module.inc';
    system_register('module', 'foo', 'modules/bar/foo.module');
}

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