You are here

public function PluginIdTest::testCacheMaxAge in Plugin 8.2

@covers ::getCacheMaxAge @covers ::getCacheableMetadata

@dataProvider provideCacheMaxAge

File

tests/src/Unit/Plugin/views/filter/PluginIdTest.php, line 136

Class

PluginIdTest
@coversDefaultClass \Drupal\plugin\Plugin\views\filter\PluginId

Namespace

Drupal\Tests\plugin\Unit\Plugin\views\filter

Code

public function testCacheMaxAge($expected, $plugin_manager_max_age) {
  $plugin_manager = $this
    ->prophesize(CacheableDependencyPluginManagerInterface::class);
  $plugin_manager
    ->getCacheContexts()
    ->willReturn([]);
  $plugin_manager
    ->getCacheTags()
    ->willReturn([]);
  $plugin_manager
    ->getCacheMaxAge()
    ->willReturn($plugin_manager_max_age);
  $this->pluginType
    ->getPluginManager()
    ->willReturn($plugin_manager
    ->reveal());
  $this
    ->assertSame($expected, $this->sut
    ->getCacheMaxAge());
}