Browse Source

Issue #3176561 by beram: Add a test for block plugin cache metadata

merge-requests/7/head
Chi 4 years ago
parent
commit
3897d7de66
  1. 2
      tests/src/Kernel/AccessTest.php
  2. 7
      tests/twig_tweak_test/src/Plugin/Block/FooBlock.php

2
tests/src/Kernel/AccessTest.php

@ -319,7 +319,7 @@ class AccessTest extends KernelTestBase {
self::assertSame($expected_content, $build['content']);
$expected_cache = [
'contexts' => ['user'],
'tags' => ['tag_from_blockAccess'],
'tags' => ['tag_from_blockAccess', 'tag_twig_tweak_test_foo_plugin'],
'max-age' => 35,
];
self::assertSame($expected_cache, $build['#cache']);

7
tests/twig_tweak_test/src/Plugin/Block/FooBlock.php

@ -41,4 +41,11 @@ class FooBlock extends BlockBase {
];
}
/**
* {@inheritdoc}
*/
public function getCacheTags() {
return ['tag_twig_tweak_test_foo_plugin'];
}
}

Loading…
Cancel
Save