trait AssertViewsCacheTagsTrait (View source)

Traits

AssertPageCacheContextsAndTagsTrait

Methods

array
assertViewsCacheTags(ViewExecutable $view, null|string[] $expected_results_cache, bool $views_caching_is_enabled, array $expected_render_array_cache_tags)

Asserts a view's result & render cache items' cache tags.

array
assertViewsCacheTagsFromStaticRenderArray(ViewExecutable $view, array $expected_render_array_cache_tags, bool $views_caching_is_enabled)

Asserts a view's result & render cache items' cache tags.

Details

protected array assertViewsCacheTags(ViewExecutable $view, null|string[] $expected_results_cache, bool $views_caching_is_enabled, array $expected_render_array_cache_tags)

Asserts a view's result & render cache items' cache tags.

This methods uses a full view object in order to render the view.

Parameters

ViewExecutable $view

The view to test, must have caching enabled.

null|string[] $expected_results_cache

NULL when expecting no results cache item, a set of cache tags expected to be set on the results cache item otherwise.

bool $views_caching_is_enabled

Whether to expect an output cache item. If TRUE, the cache tags must match those in $expected_render_array_cache_tags.

array $expected_render_array_cache_tags

A set of cache tags expected to be set on the built view's render array.

Return Value

array

The render array.

protected array assertViewsCacheTagsFromStaticRenderArray(ViewExecutable $view, array $expected_render_array_cache_tags, bool $views_caching_is_enabled)

Asserts a view's result & render cache items' cache tags.

This method starts with a pre bubbling basic render array.

Parameters

ViewExecutable $view

The view.

array $expected_render_array_cache_tags

The expected render cache tags.

bool $views_caching_is_enabled

Defines whether views output / render caching is enabled.

Return Value

array

The render array.