You are here

protected function AdvancedPluginSelectorBaseTest::configureMockCacheableDependency in Plugin 8.2

Configures a CacheableDependencyInterface mock.

@Param string[] $tags

Parameters

\PHPUnit\Framework\MockObject\MockObject $mock: The mock to configure. It must also implement \Drupal\Core\Cache\CacheableDependencyInterface.

string[] $contexts:

int $max_age:

1 call to AdvancedPluginSelectorBaseTest::configureMockCacheableDependency()
AdvancedPluginSelectorBaseTest::testBuildSelectorFormWithMultipleAvailablePlugins in tests/src/Unit/Plugin/Plugin/PluginSelector/AdvancedPluginSelectorBaseTest.php
@covers ::buildSelectorForm @covers ::setPluginSelector

File

tests/src/Unit/Plugin/Plugin/PluginSelector/AdvancedPluginSelectorBaseTest.php, line 227

Class

AdvancedPluginSelectorBaseTest
@coversDefaultClass \Drupal\plugin\Plugin\Plugin\PluginSelector\AdvancedPluginSelectorBase

Namespace

Drupal\Tests\plugin\Unit\Plugin\Plugin\PluginSelector

Code

protected function configureMockCacheableDependency(MockObject $mock, array $contexts, $max_age, array $tags) {
  $mock
    ->expects($this
    ->atLeastOnce())
    ->method('getCacheContexts')
    ->willReturn($contexts);
  $mock
    ->expects($this
    ->atLeastOnce())
    ->method('getCacheMaxAge')
    ->willReturn($max_age);
  $mock
    ->expects($this
    ->atLeastOnce())
    ->method('getCacheTags')
    ->willReturn($tags);
}