function AutowireTest::testAutowire
Same name in other branches
- 10 core/tests/Drupal/KernelTests/Core/DependencyInjection/AutowireTest.php \Drupal\KernelTests\Core\DependencyInjection\AutowireTest::testAutowire()
- 11.x 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());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.