You are here

public function ContainerTest::test_initialized in Service Container 7

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

Tests that Container::initialized works correctly. @covers ::initialized()

File

tests/src/DependencyInjection/ContainerTest.php, line 353
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_initialized() {
  $this
    ->assertFalse($this->container
    ->initialized('late.service'), 'Late service is not initialized.');
  $this->container
    ->get('late.service');
  $this
    ->assertTrue($this->container
    ->initialized('late.service'), 'Late service is initialized after it was gotten.');
}