function ModuleHandlerTest::testGetNameDeprecation

Same name in other branches
  1. 11.x 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 \Drupal\Core\Extension\ModuleHandler

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.