public function AutowireTest::testAutowire in Drupal 10
Same name and namespace in other branches
- 9 core/tests/Drupal/KernelTests/Core/DependencyInjection/AutowireTest.php \Drupal\KernelTests\Core\DependencyInjection\AutowireTest::testAutowire()
Tests that 'autowire_test.service' has its dependencies injected.
File
- core/
tests/ Drupal/ KernelTests/ Core/ DependencyInjection/ AutowireTest.php, line 25
Class
- AutowireTest
- Tests auto-wiring services.
Namespace
Drupal\KernelTests\Core\DependencyInjectionCode
public function testAutowire() : void {
// Ensure an autowired interface works.
$this
->assertInstanceOf(TestInjection::class, $this->container
->get(TestService::class)
->getTestInjection());
// Ensure an autowired class works.
$this
->assertInstanceOf(TestInjection2::class, $this->container
->get(TestService::class)
->getTestInjection2());
}