public function ViewsDisplayCachingTest::displayCacheabilityProvider in Search API 8
Data provider for testDisplayCacheability().
Return value
array Array of method call argument arrays for testDisplayCacheability().
See also
::testDisplayCacheability
File
- tests/
src/ Kernel/ Views/ ViewsDisplayCachingTest.php, line 314
Class
- ViewsDisplayCachingTest
- Tests the Search API caching plugins for Views.
Namespace
Drupal\Tests\search_api\Kernel\ViewsCode
public function displayCacheabilityProvider() {
return [
// First test case, using the 'none' caching plugin that is included with
// Views. This is expected to disable caching.
[
'none',
// Cache tags for index and view config are included at the query level,
// so should still be present even when disabling caching.
[
'config:search_api.index.database_search_index',
'config:views.view.search_api_test_cache',
],
// No specific cache contexts are expected to be present.
[],
// The cache max-age should be returned as zero, effectively disabling
// the cache.
0,
// It is expected that no results are cached.
FALSE,
],
// Test case using cache tags based caching. This should provide relevant
// cache tags so that the results can be cached permanently, but be
// invalidated whenever relevant changes occur.
[
'tag',
[
// The cache should be invalidated when either index or view are
// modified.
'config:search_api.index.database_search_index',
'config:views.view.search_api_test_cache',
// The view shows an entity, so it should be invalidated when that
// entity changes.
'entity_test_mulrev_changed:1',
// Caches should also be invalidated if any items on the index are
// indexed or deleted.
'search_api_list:database_search_index',
],
// No specific cache contexts are expected to be present.
[],
// For tag based caching it is expected that the cache life time is set
// to permanent.
Cache::PERMANENT,
// It is expected that views results can be cached.
TRUE,
],
// Test case using time based caching. This should invalidate the caches
// after a predefined time period.
[
'time',
[
// The cache should be invalidated when either index or view are
// modified.
'config:search_api.index.database_search_index',
'config:views.view.search_api_test_cache',
],
// No specific cache contexts are expected to be present.
[],
// It is expected that the cache max-age is set to 1 hour.
3600,
// It is expected that views results can be cached.
TRUE,
],
];
}