You are here

public function CachedContainerBuilderTest::test_isCached in Service Container 7

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

Tests that CachedContainerBuilder::isCached() works properly. @covers ::__construct() @covers ::isCached() @covers ::getCache()

File

tests/src/DependencyInjection/CachedContainerBuilderTest.php, line 56
Contains \Drupal\Tests\service_container\DependencyInjection\CachedContainerBuilderTest

Class

CachedContainerBuilderTest
@coversDefaultClass \Drupal\service_container\DependencyInjection\CachedContainerBuilder @group dic

Namespace

Drupal\Tests\service_container\DependencyInjection

Code

public function test_isCached() {

  // It is cached.
  $cached_container_builder = $this
    ->getCachedContainerBuilderMock('service_container:container_definition');
  $this
    ->assertTrue($cached_container_builder
    ->isCached(), 'CachedContainerBuilder is cached.');

  // It is not cached.
  $uncached_container_builder = $this
    ->getCachedContainerBuilderMock('service_container:miss_container_definition');
  $this
    ->assertFalse($uncached_container_builder
    ->isCached(), 'CachedContainerBuilder is not cached.');
}