function ContainerTest::testResolveServicesAndParametersForServiceInstantiatedFromParameter

Tests that a parameter that points to a service works correctly.

@legacy-covers ::get @legacy-covers ::createService @legacy-covers ::resolveServicesAndParameters

File

core/tests/Drupal/Tests/Component/DependencyInjection/ContainerTest.php, line 629

Class

ContainerTest
Tests Drupal\Component\DependencyInjection\Container.

Namespace

Drupal\Tests\Component\DependencyInjection

Code

public function testResolveServicesAndParametersForServiceInstantiatedFromParameter() : void {
  $service = $this->container
    ->get('service.provider');
  $test_service = $this->container
    ->get('service_with_parameter_service');
  $this->assertSame($service, $test_service->getSomeOtherService(), 'Service was passed via parameter.');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.