function ContainerTest::testGetForWrongFactory

Tests that Container::get() for wrong factories works correctly.

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

File

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

Class

ContainerTest
Tests Drupal\Component\DependencyInjection\Container.

Namespace

Drupal\Tests\Component\DependencyInjection

Code

public function testGetForWrongFactory() : void {
  $this->expectException(RuntimeException::class);
  $this->container
    ->get('wrong_factory');
}

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