You are here

protected function UnitTestCase::getContainerWithCacheTagsInvalidator in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/tests/Drupal/Tests/UnitTestCase.php \Drupal\Tests\UnitTestCase::getContainerWithCacheTagsInvalidator()

Sets up a container with a cache tags invalidator.

Parameters

\Drupal\Core\Cache\CacheTagsInvalidatorInterface $cache_tags_validator: The cache tags invalidator.

Return value

\Symfony\Component\DependencyInjection\ContainerInterface|\PHPUnit_Framework_MockObject_MockObject The container with the cache tags invalidator service.

4 calls to UnitTestCase::getContainerWithCacheTagsInvalidator()
CacheCollectorTest::setUp in core/tests/Drupal/Tests/Core/Cache/CacheCollectorTest.php
DefaultPluginManagerTest::testCacheClearWithTags in core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php
Tests the plugin manager cache clear with tags.
ThemeHandlerTest::setUp in core/tests/Drupal/Tests/Core/Extension/ThemeHandlerTest.php
ViewsDataTest::setUp in core/modules/views/tests/src/Unit/ViewsDataTest.php

File

core/tests/Drupal/Tests/UnitTestCase.php, line 239
Contains \Drupal\Tests\UnitTestCase.

Class

UnitTestCase
Provides a base class and helpers for Drupal unit tests.

Namespace

Drupal\Tests

Code

protected function getContainerWithCacheTagsInvalidator(CacheTagsInvalidatorInterface $cache_tags_validator) {
  $container = $this
    ->getMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
  $container
    ->expects($this
    ->any())
    ->method('get')
    ->with('cache_tags.invalidator')
    ->will($this
    ->returnValue($cache_tags_validator));
  \Drupal::setContainer($container);
  return $container;
}