DecoratedServiceTest.php in Drupal 10
File
core/modules/system/tests/src/Kernel/DecoratedServiceTest.php
View source
<?php
namespace Drupal\Tests\system\Kernel;
use Drupal\decorated_service_test\TestServiceDecorator;
use Drupal\KernelTests\KernelTestBase;
class DecoratedServiceTest extends KernelTestBase {
protected static $modules = [
'decorated_service_test',
];
public function testDecoratedServiceId() {
$test_service = $this->container
->get('test_service');
$this
->assertEquals('test_service', $test_service->_serviceId);
$this
->assertInstanceOf(TestServiceDecorator::class, $test_service);
$test_service2 = $this->container
->get('test_service2');
$this
->assertEquals('test_service2', $test_service2->_serviceId);
$this
->assertInstanceOf(TestServiceDecorator::class, $test_service2);
}
}