public function DecoratedServiceTest::testDecoratedServiceId in Drupal 10
Check that decorated services keep their original service ID.
File
- core/
modules/ system/ tests/ src/ Kernel/ DecoratedServiceTest.php, line 22
Class
- DecoratedServiceTest
- Test handling of decorated services in DependencySerializationTraitPass.
Namespace
Drupal\Tests\system\KernelCode
public function testDecoratedServiceId() {
// Service decorated once.
$test_service = $this->container
->get('test_service');
$this
->assertEquals('test_service', $test_service->_serviceId);
$this
->assertInstanceOf(TestServiceDecorator::class, $test_service);
// Service decorated twice.
$test_service2 = $this->container
->get('test_service2');
$this
->assertEquals('test_service2', $test_service2->_serviceId);
$this
->assertInstanceOf(TestServiceDecorator::class, $test_service2);
}