class DecoratedServiceTest
Same name and namespace in other branches
- 11.x core/modules/system/tests/src/Kernel/DecoratedServiceTest.php \Drupal\Tests\system\Kernel\DecoratedServiceTest
- 10 core/modules/system/tests/src/Kernel/DecoratedServiceTest.php \Drupal\Tests\system\Kernel\DecoratedServiceTest
Test handling of decorated services in DependencySerializationTraitPass.
@group system
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \Drupal\Core\DependencyInjection\ServiceProviderInterface uses \Drupal\KernelTests\AssertLegacyTrait, \Drupal\KernelTests\AssertContentTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\ExtensionListTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\Traits\PhpUnitWarnings, \Drupal\Tests\PhpUnitCompatibilityTrait, \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait implements \PHPUnit\Framework\TestCase
- class \Drupal\Tests\system\Kernel\DecoratedServiceTest implements \Drupal\KernelTests\KernelTestBase
Expanded class hierarchy of DecoratedServiceTest
File
-
core/
modules/ system/ tests/ src/ Kernel/ DecoratedServiceTest.php, line 14
Namespace
Drupal\Tests\system\KernelView source
class DecoratedServiceTest extends KernelTestBase {
protected static $modules = [
'decorated_service_test',
];
/**
* Check that decorated services keep their original service ID.
*/
public function testDecoratedServiceId() {
// Service decorated once.
$test_service = $this->container
->get('test_service');
$this->assertEquals('test_service', $this->container
->get(ReverseContainer::class)
->getId($test_service));
$this->assertInstanceOf(TestServiceDecorator::class, $test_service);
// Service decorated twice.
$test_service2 = $this->container
->get('test_service2');
$this->assertEquals('test_service2', $this->container
->get(ReverseContainer::class)
->getId($test_service2));
$this->assertInstanceOf(TestServiceDecorator::class, $test_service2);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.