protected function ViewsDisplayCachingTest::triggerInvalidation in Search API 8
Triggers the event that should provoke a cache invalidation.
Parameters
string $plugin_type: The views cache plugin type for which a cache invalidation should be triggered. Can be 'none', 'tag' or 'time'.
1 call to ViewsDisplayCachingTest::triggerInvalidation()
- ViewsDisplayCachingTest::testDisplayCacheability in tests/
src/ Kernel/ Views/ ViewsDisplayCachingTest.php - Tests whether the search display plugin for a new view is available.
File
- tests/
src/ Kernel/ Views/ ViewsDisplayCachingTest.php, line 211
Class
- ViewsDisplayCachingTest
- Tests the Search API caching plugins for Views.
Namespace
Drupal\Tests\search_api\Kernel\ViewsCode
protected function triggerInvalidation($plugin_type) {
switch ($plugin_type) {
// When using the 'tag' based caching strategy, create and index a new
// entity of the type that is used in the index. This should clear it.
case 'tag':
EntityTestMulRevChanged::create([
'name' => 'Tomahawk',
])
->save();
$this->index
->indexItems();
break;
// When using 'time' based caching, pretend to be more than 1 hour in the
// future.
case 'time':
$this->cache
->setRequestTime($this->cache
->getRequestTime() + 3700);
break;
}
}