function UnitTestCase::getContainerWithCacheTagsInvalidator
Same name and namespace in other branches
- 11.x core/tests/Drupal/Tests/UnitTestCase.php \Drupal\Tests\UnitTestCase::getContainerWithCacheTagsInvalidator()
- 10 core/tests/Drupal/Tests/UnitTestCase.php \Drupal\Tests\UnitTestCase::getContainerWithCacheTagsInvalidator()
- 9 core/tests/Drupal/Tests/UnitTestCase.php \Drupal\Tests\UnitTestCase::getContainerWithCacheTagsInvalidator()
- 8.9.x 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.
5 calls to UnitTestCase::getContainerWithCacheTagsInvalidator()
- CacheCollectorTest::testUpdateCacheClearTags in core/
tests/ Drupal/ Tests/ Core/ Cache/ CacheCollectorTest.php - Tests a clear of the cache collector using tags.
- DefaultPluginManagerTest::testCacheClearWithTags in core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultPluginManagerTest.php - Tests the plugin manager cache clear with tags.
- MenuActiveTrailTest::testGetActiveTrailIds in core/
tests/ Drupal/ Tests/ Core/ Menu/ MenuActiveTrailTest.php - Tests getActiveTrailIds().
- ViewsDataTest::testClearResetsFullyLoaded in core/
modules/ views/ tests/ src/ Unit/ ViewsDataTest.php - Tests that clear() resets the fullyLoaded property.
- ViewsDataTest::testFullAndTableGetCache in core/
modules/ views/ tests/ src/ Unit/ ViewsDataTest.php - Tests the cache of the full and single table data.
File
-
core/
tests/ Drupal/ Tests/ UnitTestCase.php, line 159
Class
- UnitTestCase
- Provides a base class and helpers for Drupal unit tests.
Namespace
Drupal\TestsCode
protected function getContainerWithCacheTagsInvalidator(CacheTagsInvalidatorInterface $cache_tags_validator) {
$container = $this->createMock('Symfony\\Component\\DependencyInjection\\ContainerInterface');
$container->expects($this->atLeastOnce())
->method('get')
->with('cache_tags.invalidator')
->willReturn($cache_tags_validator);
\Drupal::setContainer($container);
return $container;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.