function ContainerTest::testGetForAliasedService

Tests that Container::get() for aliased services works properly.

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

File

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

Class

ContainerTest
Tests Drupal\Component\DependencyInjection\Container.

Namespace

Drupal\Tests\Component\DependencyInjection

Code

public function testGetForAliasedService() : void {
  $service = $this->container
    ->get('service.provider');
  $aliased_service = $this->container
    ->get('service.provider_alias');
  $this->assertSame($service, $aliased_service);
}

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