protected function UnitTestCase::getContainerWithCacheTagsInvalidator in Drupal 10
Same name and namespace in other branches
- 8 core/tests/Drupal/Tests/UnitTestCase.php \Drupal\Tests\UnitTestCase::getContainerWithCacheTagsInvalidator()
- 9 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.
1 call to UnitTestCase::getContainerWithCacheTagsInvalidator()
- DefaultPluginManagerTest::testCacheClearWithTags in core/
tests/ Drupal/ Tests/ Core/ Plugin/ DefaultPluginManagerTest.php - Tests the plugin manager cache clear with tags.
File
- core/
tests/ Drupal/ Tests/ UnitTestCase.php, line 228
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
->any())
->method('get')
->with('cache_tags.invalidator')
->will($this
->returnValue($cache_tags_validator));
\Drupal::setContainer($container);
return $container;
}