You are here

class ViewsDisplayCachingTest in Search API 8

Tests the Search API caching plugins for Views.

@group search_api

Hierarchy

Expanded class hierarchy of ViewsDisplayCachingTest

File

tests/src/Kernel/Views/ViewsDisplayCachingTest.php, line 19

Namespace

Drupal\Tests\search_api\Kernel\Views
View source
class ViewsDisplayCachingTest extends KernelTestBase {
  use AssertViewsCacheTagsTrait;

  /**
   * The entity type manager.
   *
   * @var \Drupal\Core\Entity\EntityTypeManagerInterface
   */
  protected $entityTypeManager;

  /**
   * The service that is responsible for creating Views executable objects.
   *
   * @var \Drupal\views\ViewExecutableFactory
   */
  protected $viewExecutableFactory;

  /**
   * The search index used for testing.
   *
   * @var \Drupal\search_api\IndexInterface
   */
  protected $index;

  /**
   * The cache backend used for testing.
   *
   * @var \Drupal\Tests\search_api\Kernel\Views\TestMemoryBackend
   */
  protected $cache;

  /**
   * {@inheritdoc}
   */
  public static $modules = [
    'entity_test',
    'field',
    'rest',
    'search_api',
    'search_api_db',
    'search_api_test',
    'search_api_test_db',
    'search_api_test_example_content',
    'search_api_test_views',
    'serialization',
    'system',
    'text',
    'user',
    'views',
  ];

  /**
   * {@inheritdoc}
   */
  protected function setUp() {
    parent::setUp();
    $this
      ->installSchema('search_api', [
      'search_api_item',
    ]);
    $this
      ->installEntitySchema('entity_test_mulrev_changed');
    $this
      ->installEntitySchema('search_api_task');
    $this
      ->installConfig([
      'search_api',
      'search_api_test_example_content',
      'search_api_test_db',
      'search_api_test_views',
    ]);
    $this->entityTypeManager = $this->container
      ->get('entity_type.manager');
    $this->viewExecutableFactory = $this->container
      ->get('views.executable');

    // Use the test search index from the search_api_test_db module.
    $this->index = Index::load('database_search_index');

    // Use a test cache backend that allows to tamper with the request time so
    // we can test time based caching.
    $this->cache = new TestMemoryBackend();
    $this->container
      ->set('cache.data', $this->cache);

    // Create some demo content and index it.
    $this
      ->createDemoContent();
    $this->index
      ->indexItems();
  }

  /**
   * Tests whether the search display plugin for a new view is available.
   *
   * @param string $display_id
   *   The tested Views display's ID.
   * @param string[] $expected_cache_tags
   *   The expected cache tags for the executed view.
   * @param string[] $expected_cache_contexts
   *   The expected cache contexts for the executed view.
   * @param int $expected_max_age
   *   The expected max cache age for the executed view.
   * @param bool $expected_results_cache
   *   TRUE if the results cache is expected to be populated after executing the
   *   view, FALSE otherwise.
   *
   * @dataProvider displayCacheabilityProvider
   */
  public function testDisplayCacheability($display_id, array $expected_cache_tags, array $expected_cache_contexts, $expected_max_age, $expected_results_cache) {
    $view = $this
      ->getView('search_api_test_cache', $display_id);

    // Before the search is executed, the query should not be cached.
    $this
      ->assertViewsResultsCacheNotPopulated($view);

    // Execute the search and assert the cacheability metadata.
    $this
      ->assertViewsCacheability($view, $expected_cache_tags, $expected_cache_contexts, $expected_max_age);

    // AssertViewsCache() destroys the view, get a fresh copy to continue the
    // test.
    $view = $this
      ->getView('search_api_test_cache', $display_id);

    // The query has been executed. The query should now be cached if the test
    // case expects it.
    if ($expected_results_cache) {
      $this
        ->assertViewsResultsCachePopulated($view);

      // Trigger the event that would cause a cache invalidation for the plugin
      // under test. Now the query result should not be cached any more.
      $this
        ->triggerInvalidation($display_id);
    }
    $this
      ->assertViewsResultsCacheNotPopulated($view);
  }

  /**
   * Checks that the query result of the given view is not currently cached.
   *
   * @param \Drupal\views\ViewExecutable $view
   *   The view to check.
   */
  protected function assertViewsResultsCacheNotPopulated(ViewExecutable $view) {
    $this
      ->assertEmpty($this
      ->getResultsCache($view));
  }

  /**
   * Checks that the query result of the given view is currently cached.
   *
   * @param \Drupal\views\ViewExecutable $view
   *   The view to check.
   */
  protected function assertViewsResultsCachePopulated(ViewExecutable $view) {
    $this
      ->assertNotEmpty($this
      ->getResultsCache($view));
  }

  /**
   * Returns the current query result cache of the given view.
   *
   * @param \Drupal\views\ViewExecutable $view
   *   The view for which to return the query result cache.
   *
   * @return false|object
   *   The cache object, or FALSE if the query cache is not populated.
   */
  protected function getResultsCache(ViewExecutable $view) {

    /** @var \Drupal\views\Plugin\views\cache\CachePluginBase $cache_plugin */
    $cache_plugin = $view->display_handler
      ->getPlugin('cache');

    // Ensure that the views query is built.
    $view
      ->build();
    return $this->cache
      ->get($cache_plugin
      ->generateResultsKey());
  }

  /**
   * Checks the cacheability metadata of the given view.
   *
   * @param \Drupal\views\ViewExecutable $view
   *   The view to test.
   * @param string[] $expected_cache_tags
   *   The expected cache tags.
   * @param string[] $expected_cache_contexts
   *   The expected cache contexts.
   * @param int $expected_max_age
   *   The expected cache max age.
   */
  protected function assertViewsCacheability(ViewExecutable $view, array $expected_cache_tags, array $expected_cache_contexts, $expected_max_age) {
    $build = $this
      ->assertViewsCacheTags($view, NULL, FALSE, $expected_cache_tags);
    $this
      ->assertCacheContexts($expected_cache_contexts, $build);
    $this
      ->assertCacheMaxAge($expected_max_age, $build);
  }

  /**
   * Triggers the event that should provoke a cache invalidation.
   *
   * @param string $plugin_type
   *   The views cache plugin type for which a cache invalidation should be
   *   triggered. Can be 'none', 'tag' or 'time'.
   */
  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;
    }
  }

  /**
   * Creates some test axes.
   */
  protected function createDemoContent() {
    foreach ([
      'Glaive',
      'Halberd',
      'Hurlbat',
    ] as $name) {
      EntityTestMulRevChanged::create([
        'name' => $name,
      ])
        ->save();
    }
  }

  /**
   * Loads a view from configuration and returns its executable object.
   *
   * @param string $id
   *   The view ID to load.
   * @param string $display_id
   *   The display ID to set.
   *
   * @return \Drupal\views\ViewExecutable
   *   A view executable instance, from the loaded entity.
   */
  protected function getView($id, $display_id) {

    /** @var \Drupal\views\ViewEntityInterface $view */
    $view = $this->entityTypeManager
      ->getStorage('view')
      ->load($id);
    $executable = $this->viewExecutableFactory
      ->get($view);
    $executable
      ->setDisplay($display_id);
    $executable
      ->setExposedInput([
      'search_api_fulltext' => 'Glaive',
    ]);
    return $executable;
  }

  /**
   * Checks if the cache contexts in the given render array are as expected.
   *
   * @param string[] $expected_contexts
   *   An array of cache contexts that are expected to be present in the given
   *   render array.
   * @param array $render_array
   *   The render array of which to check the cache contexts.
   */
  protected function assertCacheContexts(array $expected_contexts, array $render_array) {

    // Merge in the default cache contexts in the expected contexts.
    $default_contexts = [
      // Default contexts that are always provided by core.
      'languages:' . LanguageInterface::TYPE_INTERFACE,
      'theme',
      'user.permissions',
      // We are showing translatable content, so it varies by content language.
      'languages:' . LanguageInterface::TYPE_CONTENT,
      // Our view has a pager, so we vary by query arguments.
      // @see \Drupal\views\Plugin\views\pager\SqlBase::getCacheContexts()
      'url.query_args',
      // Since our view has exposed filters, it varies by url.
      // @see \Drupal\views\Plugin\views\exposed_form\ExposedFormPluginBase::getCacheContexts()
      'url',
    ];
    $expected_contexts = Cache::mergeContexts($expected_contexts, $default_contexts);
    $actual_contexts = CacheableMetadata::createFromRenderArray($render_array)
      ->getCacheContexts();
    sort($expected_contexts);
    sort($actual_contexts);
    $this
      ->assertEquals($expected_contexts, $actual_contexts);
  }

  /**
   * Checks if the cache max-age in the given render array is as expected.
   *
   * @param int $expected_max_age
   *   The max-age value that is expected to be present in the given render
   *   array.
   * @param array $render_array
   *   The render array of which to check the cache max-age.
   */
  protected function assertCacheMaxAge($expected_max_age, array $render_array) {
    $actual_max_age = CacheableMetadata::createFromRenderArray($render_array)
      ->getCacheMaxAge();
    $this
      ->assertEquals($expected_max_age, $actual_max_age);
  }

  /**
   * Data provider for testDisplayCacheability().
   *
   * @return array
   *   Array of method call argument arrays for testDisplayCacheability().
   *
   * @see ::testDisplayCacheability
   */
  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,
      ],
    ];
  }

}

Members

Namesort descending Modifiers Type Description Overrides
AssertContentTrait::$content protected property The current raw content.
AssertContentTrait::$drupalSettings protected property The drupalSettings value from the current raw $content.
AssertContentTrait::$elements protected property The XML structure parsed from the current raw $content. 1
AssertContentTrait::$plainTextContent protected property The plain-text content of raw $content (text nodes).
AssertContentTrait::assertEscaped protected function Passes if the raw text IS found escaped on the loaded page, fail otherwise.
AssertContentTrait::assertField protected function Asserts that a field exists with the given name or ID.
AssertContentTrait::assertFieldById protected function Asserts that a field exists with the given ID and value.
AssertContentTrait::assertFieldByName protected function Asserts that a field exists with the given name and value.
AssertContentTrait::assertFieldByXPath protected function Asserts that a field exists in the current page by the given XPath.
AssertContentTrait::assertFieldChecked protected function Asserts that a checkbox field in the current page is checked.
AssertContentTrait::assertFieldsByValue protected function Asserts that a field exists in the current page with a given Xpath result.
AssertContentTrait::assertLink protected function Passes if a link with the specified label is found.
AssertContentTrait::assertLinkByHref protected function Passes if a link containing a given href (part) is found.
AssertContentTrait::assertNoDuplicateIds protected function Asserts that each HTML ID is used for just a single element.
AssertContentTrait::assertNoEscaped protected function Passes if the raw text IS NOT found escaped on the loaded page, fail otherwise.
AssertContentTrait::assertNoField protected function Asserts that a field does not exist with the given name or ID.
AssertContentTrait::assertNoFieldById protected function Asserts that a field does not exist with the given ID and value.
AssertContentTrait::assertNoFieldByName protected function Asserts that a field does not exist with the given name and value.
AssertContentTrait::assertNoFieldByXPath protected function Asserts that a field does not exist or its value does not match, by XPath.
AssertContentTrait::assertNoFieldChecked protected function Asserts that a checkbox field in the current page is not checked.
AssertContentTrait::assertNoLink protected function Passes if a link with the specified label is not found.
AssertContentTrait::assertNoLinkByHref protected function Passes if a link containing a given href (part) is not found.
AssertContentTrait::assertNoLinkByHrefInMainRegion protected function Passes if a link containing a given href is not found in the main region.
AssertContentTrait::assertNoOption protected function Asserts that a select option in the current page does not exist.
AssertContentTrait::assertNoOptionSelected protected function Asserts that a select option in the current page is not checked.
AssertContentTrait::assertNoPattern protected function Triggers a pass if the perl regex pattern is not found in raw content.
AssertContentTrait::assertNoRaw protected function Passes if the raw text is NOT found on the loaded page, fail otherwise.
AssertContentTrait::assertNoText protected function Passes if the page (with HTML stripped) does not contains the text.
AssertContentTrait::assertNoTitle protected function Pass if the page title is not the given string.
AssertContentTrait::assertNoUniqueText protected function Passes if the text is found MORE THAN ONCE on the text version of the page.
AssertContentTrait::assertOption protected function Asserts that a select option in the current page exists.
AssertContentTrait::assertOptionByText protected function Asserts that a select option with the visible text exists.
AssertContentTrait::assertOptionSelected protected function Asserts that a select option in the current page is checked.
AssertContentTrait::assertOptionSelectedWithDrupalSelector protected function Asserts that a select option in the current page is checked.
AssertContentTrait::assertOptionWithDrupalSelector protected function Asserts that a select option in the current page exists.
AssertContentTrait::assertPattern protected function Triggers a pass if the Perl regex pattern is found in the raw content.
AssertContentTrait::assertRaw protected function Passes if the raw text IS found on the loaded page, fail otherwise.
AssertContentTrait::assertText protected function Passes if the page (with HTML stripped) contains the text.
AssertContentTrait::assertTextHelper protected function Helper for assertText and assertNoText.
AssertContentTrait::assertTextPattern protected function Asserts that a Perl regex pattern is found in the plain-text content.
AssertContentTrait::assertThemeOutput protected function Asserts themed output.
AssertContentTrait::assertTitle protected function Pass if the page title is the given string.
AssertContentTrait::assertUniqueText protected function Passes if the text is found ONLY ONCE on the text version of the page.
AssertContentTrait::assertUniqueTextHelper protected function Helper for assertUniqueText and assertNoUniqueText.
AssertContentTrait::buildXPathQuery protected function Builds an XPath query.
AssertContentTrait::constructFieldXpath protected function Helper: Constructs an XPath for the given set of attributes and value.
AssertContentTrait::cssSelect protected function Searches elements using a CSS selector in the raw content.
AssertContentTrait::getAllOptions protected function Get all option elements, including nested options, in a select.
AssertContentTrait::getDrupalSettings protected function Gets the value of drupalSettings for the currently-loaded page.
AssertContentTrait::getRawContent protected function Gets the current raw content.
AssertContentTrait::getSelectedItem protected function Get the selected value from a select field.
AssertContentTrait::getTextContent protected function Retrieves the plain-text content from the current raw content.
AssertContentTrait::getUrl protected function Get the current URL from the cURL handler. 1
AssertContentTrait::parse protected function Parse content returned from curlExec using DOM and SimpleXML.
AssertContentTrait::removeWhiteSpace protected function Removes all white-space between HTML tags from the raw content.
AssertContentTrait::setDrupalSettings protected function Sets the value of drupalSettings for the currently-loaded page.
AssertContentTrait::setRawContent protected function Sets the raw content (e.g. HTML).
AssertContentTrait::xpath protected function Performs an xpath search on the contents of the internal browser.
AssertHelperTrait::castSafeStrings protected static function Casts MarkupInterface objects into strings.
AssertLegacyTrait::assert protected function Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertTrue() instead.
AssertLegacyTrait::assertEqual protected function Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertEquals() instead.
AssertLegacyTrait::assertIdentical protected function Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertSame() instead.
AssertLegacyTrait::assertIdenticalObject protected function Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertEquals() instead.
AssertLegacyTrait::assertNotEqual protected function Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertNotEquals() instead.
AssertLegacyTrait::assertNotIdentical protected function Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertNotSame() instead.
AssertLegacyTrait::pass protected function Deprecated Scheduled for removal in Drupal 10.0.0. Use self::assertTrue() instead.
AssertLegacyTrait::verbose protected function
AssertPageCacheContextsAndTagsTrait::assertCacheContext protected function Asserts whether an expected cache context was present in the last response.
AssertPageCacheContextsAndTagsTrait::assertCacheTags protected function Ensures that some cache tags are present in the current response.
AssertPageCacheContextsAndTagsTrait::assertNoCacheContext protected function Asserts that a cache context was not present in the last response.
AssertPageCacheContextsAndTagsTrait::assertPageCacheContextsAndTags protected function Asserts page cache miss, then hit for the given URL; checks cache headers.
AssertPageCacheContextsAndTagsTrait::enablePageCaching protected function Enables page caching.
AssertPageCacheContextsAndTagsTrait::getCacheHeaderValues protected function Gets a specific header value as array.
AssertViewsCacheTagsTrait::assertViewsCacheTags protected function Asserts a view's result & render cache items' cache tags.
AssertViewsCacheTagsTrait::assertViewsCacheTagsFromStaticRenderArray protected function Asserts a view's result & render cache items' cache tags.
ConfigTestTrait::configImporter protected function Returns a ConfigImporter object to import test configuration.
ConfigTestTrait::copyConfig protected function Copies configuration objects from source storage to target storage.
KernelTestBase::$backupGlobals protected property Back up and restore any global variables that may be changed by tests.
KernelTestBase::$backupStaticAttributes protected property Back up and restore static class properties that may be changed by tests.
KernelTestBase::$backupStaticAttributesBlacklist protected property Contains a few static class properties for performance.
KernelTestBase::$classLoader protected property
KernelTestBase::$configImporter protected property @todo Move into Config test base class. 7
KernelTestBase::$configSchemaCheckerExclusions protected static property An array of config object names that are excluded from schema checking.
KernelTestBase::$container protected property
KernelTestBase::$databasePrefix protected property
KernelTestBase::$preserveGlobalState protected property Do not forward any global state from the parent process to the processes that run the actual tests.
KernelTestBase::$root protected property The app root.
KernelTestBase::$runTestInSeparateProcess protected property Kernel tests are run in separate processes because they allow autoloading of code from extensions. Running the test in a separate process isolates this behavior from other tests. Subclasses should not override this property.
KernelTestBase::$siteDirectory protected property
KernelTestBase::$strictConfigSchema protected property Set to TRUE to strict check all configuration saved. 6
KernelTestBase::$vfsRoot protected property The virtual filesystem root directory.
KernelTestBase::assertPostConditions protected function 1
KernelTestBase::bootEnvironment protected function Bootstraps a basic test environment.
KernelTestBase::bootKernel private function Bootstraps a kernel for a test.
KernelTestBase::config protected function Configuration accessor for tests. Returns non-overridden configuration.
KernelTestBase::disableModules protected function Disables modules for this test.
KernelTestBase::enableModules protected function Enables modules for this test.
KernelTestBase::getConfigSchemaExclusions protected function Gets the config schema exclusions for this test.
KernelTestBase::getDatabaseConnectionInfo protected function Returns the Database connection info to be used for this test. 1
KernelTestBase::getDatabasePrefix public function
KernelTestBase::getExtensionsForModules private function Returns Extension objects for $modules to enable.
KernelTestBase::getModulesToEnable private static function Returns the modules to enable for this test.
KernelTestBase::initFileCache protected function Initializes the FileCache component.
KernelTestBase::installConfig protected function Installs default configuration for a given list of modules.
KernelTestBase::installEntitySchema protected function Installs the storage schema for a specific entity type.
KernelTestBase::installSchema protected function Installs database tables from a module schema definition.
KernelTestBase::isTestInIsolation Deprecated protected function Returns whether the current test method is running in a separate process.
KernelTestBase::prepareTemplate protected function
KernelTestBase::register public function Registers test-specific services. Overrides ServiceProviderInterface::register 26
KernelTestBase::render protected function Renders a render array. 1
KernelTestBase::setInstallProfile protected function Sets the install profile and rebuilds the container to update it.
KernelTestBase::setSetting protected function Sets an in-memory Settings variable.
KernelTestBase::setUpBeforeClass public static function 1
KernelTestBase::setUpFilesystem protected function Sets up the filesystem, so things like the file directory. 2
KernelTestBase::stop protected function Stops test execution.
KernelTestBase::tearDown protected function 6
KernelTestBase::tearDownCloseDatabaseConnection public function @after
KernelTestBase::vfsDump protected function Dumps the current state of the virtual filesystem to STDOUT.
KernelTestBase::__get Deprecated public function BC: Automatically resolve former KernelTestBase class properties.
KernelTestBase::__sleep public function Prevents serializing any properties.
PhpunitCompatibilityTrait::getMock Deprecated public function Returns a mock object for the specified class using the available method.
PhpunitCompatibilityTrait::setExpectedException Deprecated public function Compatibility layer for PHPUnit 6 to support PHPUnit 4 code.
RandomGeneratorTrait::$randomGenerator protected property The random generator.
RandomGeneratorTrait::getRandomGenerator protected function Gets the random generator for the utility methods.
RandomGeneratorTrait::randomMachineName protected function Generates a unique random string containing letters and numbers. 1
RandomGeneratorTrait::randomObject public function Generates a random PHP object.
RandomGeneratorTrait::randomString public function Generates a pseudo-random string of ASCII characters of codes 32 to 126.
RandomGeneratorTrait::randomStringValidate public function Callback for random string validation.
StorageCopyTrait::replaceStorageContents protected static function Copy the configuration from one storage to another and remove stale items.
TestRequirementsTrait::checkModuleRequirements private function Checks missing module requirements.
TestRequirementsTrait::checkRequirements protected function Check module requirements for the Drupal use case. 1
TestRequirementsTrait::getDrupalRoot protected static function Returns the Drupal root directory.
ViewsDisplayCachingTest::$cache protected property The cache backend used for testing.
ViewsDisplayCachingTest::$entityTypeManager protected property The entity type manager.
ViewsDisplayCachingTest::$index protected property The search index used for testing.
ViewsDisplayCachingTest::$modules public static property Modules to enable. Overrides KernelTestBase::$modules
ViewsDisplayCachingTest::$viewExecutableFactory protected property The service that is responsible for creating Views executable objects.
ViewsDisplayCachingTest::assertCacheContexts protected function Checks if the cache contexts in the given render array are as expected. Overrides AssertPageCacheContextsAndTagsTrait::assertCacheContexts
ViewsDisplayCachingTest::assertCacheMaxAge protected function Checks if the cache max-age in the given render array is as expected. Overrides AssertPageCacheContextsAndTagsTrait::assertCacheMaxAge
ViewsDisplayCachingTest::assertViewsCacheability protected function Checks the cacheability metadata of the given view.
ViewsDisplayCachingTest::assertViewsResultsCacheNotPopulated protected function Checks that the query result of the given view is not currently cached.
ViewsDisplayCachingTest::assertViewsResultsCachePopulated protected function Checks that the query result of the given view is currently cached.
ViewsDisplayCachingTest::createDemoContent protected function Creates some test axes.
ViewsDisplayCachingTest::displayCacheabilityProvider public function Data provider for testDisplayCacheability().
ViewsDisplayCachingTest::getResultsCache protected function Returns the current query result cache of the given view.
ViewsDisplayCachingTest::getView protected function Loads a view from configuration and returns its executable object.
ViewsDisplayCachingTest::setUp protected function Overrides KernelTestBase::setUp
ViewsDisplayCachingTest::testDisplayCacheability public function Tests whether the search display plugin for a new view is available.
ViewsDisplayCachingTest::triggerInvalidation protected function Triggers the event that should provoke a cache invalidation.