public function ContainerTest::test_get_notFound_parameterWithExceptionOnSecondCall in Service Container 7.2
Same name and namespace in other branches
- 7 tests/src/DependencyInjection/ContainerTest.php \Drupal\Tests\service_container\DependencyInjection\ContainerTest::test_get_notFound_parameterWithExceptionOnSecondCall()
Tests Container::get() with an exception due to missing parameter on the second call.
@covers ::get() @covers ::resolveServicesAndParameters()
@expectedException \Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException
File
- tests/
src/ DependencyInjection/ ContainerTest.php, line 209 - Contains \Drupal\Tests\service_container\DependencyInjection\ContainerTest
Class
- ContainerTest
- @coversDefaultClass \Drupal\service_container\DependencyInjection\Container @group dic
Namespace
Drupal\Tests\service_container\DependencyInjectionCode
public function test_get_notFound_parameterWithExceptionOnSecondCall() {
$service = $this->container
->get('service_parameter_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE);
$this
->assertNull($service, 'Some service is NULL.');
// Reset the service.
$this->container
->set('service_parameter_not_exists', NULL);
$this->container
->get('service_parameter_not_exists');
}