function DrupalKernelTest::testGetServiceIdMapping

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php \Drupal\Tests\Core\DrupalKernel\DrupalKernelTest::testGetServiceIdMapping()

@covers ::getServiceIdMapping @group legacy

File

core/tests/Drupal/Tests/Core/DrupalKernel/DrupalKernelTest.php, line 148

Class

DrupalKernelTest
@coversDefaultClass \Drupal\Core\DrupalKernel @group DrupalKernel

Namespace

Drupal\Tests\Core\DrupalKernel

Code

public function testGetServiceIdMapping() : void {
    $this->expectDeprecation("Drupal\\Core\\DrupalKernel::getServiceIdMapping() is deprecated in drupal:9.5.1 and is removed from drupal:11.0.0. Use the 'Drupal\\Component\\DependencyInjection\\ReverseContainer' service instead. See https://www.drupal.org/node/3327942");
    $this->expectDeprecation("Drupal\\Core\\DrupalKernel::collectServiceIdMapping() is deprecated in drupal:9.5.1 and is removed from drupal:11.0.0. Use the 'Drupal\\Component\\DependencyInjection\\ReverseContainer' service instead. See https://www.drupal.org/node/3327942");
    $service = new BarClass();
    $container = TestKernel::setContainerWithKernel();
    $container->set('bar', $service);
    $this->assertEquals($container->get('kernel')
        ->getServiceIdMapping()[$container->generateServiceIdHash($service)], 'bar');
}

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