You are here

protected function CachedContainerBuilderTest::setupCache 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::setupCache()
1 call to CachedContainerBuilderTest::setupCache()
CachedContainerBuilderTest::getCachedContainerBuilderMock in tests/src/DependencyInjection/CachedContainerBuilderTest.php

File

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

Class

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

Namespace

Drupal\Tests\service_container\DependencyInjection

Code

protected function setupCache($fake_definition) {

  // Setup the 'cache' bin.
  $cache = Mockery::mock('\\DrupalCacheInterface');
  $cache
    ->shouldReceive('get')
    ->with('service_container:container_definition')
    ->once()
    ->andReturn((object) array(
    'data' => $fake_definition,
  ));
  $cache
    ->shouldReceive('get')
    ->with('service_container:miss_container_definition')
    ->once()
    ->andReturn(FALSE, TRUE);
  $cache
    ->shouldReceive('set');
  return $cache;
}