You are here

public function ContainerTest::test_get_notFound_parameter in Service Container 7.2

Same name and namespace in other branches
  1. 7 tests/src/DependencyInjection/ContainerTest.php \Drupal\Tests\service_container\DependencyInjection\ContainerTest::test_get_notFound_parameter()

Tests that Container::get() for non-existant parameters works properly. @covers ::get() @covers ::resolveServicesAndParameters()

File

tests/src/DependencyInjection/ContainerTest.php, line 196
Contains \Drupal\Tests\service_container\DependencyInjection\ContainerTest

Class

ContainerTest
@coversDefaultClass \Drupal\service_container\DependencyInjection\Container @group dic

Namespace

Drupal\Tests\service_container\DependencyInjection

Code

public function test_get_notFound_parameter() {
  $service = $this->container
    ->get('service_parameter_not_exists', ContainerInterface::NULL_ON_INVALID_REFERENCE);
  $this
    ->assertNull($service, 'Some service is NULL.');
}