getServiceIdMapping example

/** * @covers ::getServiceIdMapping * @group legacy */
  public function testGetServiceIdMapping() {
    $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');
  }

}

/** * A fake autoloader for testing. */
class FakeAutoloader {

  /** * Registers this instance as an autoloader. * * @param bool $prepend * Whether to prepend the autoloader or not */
Home | Imprint | This part of the site doesn't use cookies.