function ModuleHandlerTest::testGetImplementations

Same name and namespace in other branches
  1. 8.9.x core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php \Drupal\Tests\Core\Extension\ModuleHandlerTest::testGetImplementations()

Tests deprecation of the ::getImplementations method.

@covers ::getImplementations
@covers ::getImplementationInfo
@covers ::buildImplementationInfo

@group legacy

File

core/tests/Drupal/Tests/Core/Extension/ModuleHandlerTest.php, line 332

Class

ModuleHandlerTest
@coversDefaultClass \Drupal\Core\Extension\ModuleHandler[[api-linebreak]] @runTestsInSeparateProcesses

Namespace

Drupal\Tests\Core\Extension

Code

public function testGetImplementations() {
  $this->expectDeprecation('ModuleHandlerInterface::getImplementations() is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. Instead you should use ModuleHandlerInterface::invokeAllWith() for hook invocations, or you should use ModuleHandlerInterface::hasImplementations() to determine if hooks implementations exist. See https://www.drupal.org/node/3000490');
  $this->assertEquals([
    'module_handler_test',
  ], $this->getModuleHandler()
    ->getImplementations('hook'));
}

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