function ModuleHandlerTest::testGetNameDeprecation

Same name and namespace in other branches
  1. 10 core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php \Drupal\KernelTests\Core\Extension\ModuleHandlerTest::testGetNameDeprecation()

Tests deprecation of getName() function.

@group legacy

File

core/tests/Drupal/KernelTests/Core/Extension/ModuleHandlerTest.php, line 34

Class

ModuleHandlerTest
@coversDefaultClass <a href="/api/drupal/core%21lib%21Drupal%21Core%21Extension%21ModuleHandler.php/class/ModuleHandler/11.x" title="Class that manages modules in a Drupal installation." class="local">\Drupal\Core\Extension\ModuleHandler</a>

Namespace

Drupal\KernelTests\Core\Extension

Code

public function testGetNameDeprecation() : void {
    $this->expectDeprecation('Drupal\\Core\\Extension\\ModuleHandler::getName() is deprecated in drupal:10.3.0 and is removed from drupal:12.0.0. Use \\Drupal\\Core\\Extension\\ModuleExtensionList::getName($module) instead. See https://www.drupal.org/node/3310017');
    $this->assertNotNull(\Drupal::service('module_handler')->getName('module_test'));
}

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