You are here

public function CachedContainerBuilderTest::test_reset in Service Container 7.2

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

@covers ::reset()

File

tests/src/DependencyInjection/CachedContainerBuilderTest.php, line 112
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_reset() {
  $cache = Mockery::mock('\\DrupalCacheInterface');
  $cache
    ->shouldReceive('get')
    ->with('service_container:container_definition')
    ->twice()
    ->andReturn((object) array(
    'data' => $this
      ->getFakeContainerDefinition(),
  ));
  $cache
    ->shouldReceive('clear')
    ->with('service_container:container_definition')
    ->once();
  $cached_container_builder = $this
    ->getCachedContainerBuilderMock('service_container:container_definition', $cache);
  $cached_container_builder
    ->getContainerDefinition();
  $cached_container_builder
    ->getContainerDefinition();
  $cached_container_builder
    ->reset();
  $cached_container_builder
    ->getContainerDefinition();
}