function NodePerformanceTest::testPromotedContentCacheInvalidation

Same name and namespace in other branches
  1. 11.x core/modules/node/tests/src/FunctionalJavascript/NodePerformanceTest.php \Drupal\Tests\node\FunctionalJavascript\NodePerformanceTest::testPromotedContentCacheInvalidation()

Tests the impact of node cache invalidation on the promoted content view.

1 call to NodePerformanceTest::testPromotedContentCacheInvalidation()
NodePerformanceTest::testNodePerformance in core/modules/node/tests/src/FunctionalJavascript/NodePerformanceTest.php
Tests performance of node-related functionality.

File

core/modules/node/tests/src/FunctionalJavascript/NodePerformanceTest.php, line 105

Class

NodePerformanceTest
Tests the performance of node functionality including cache invalidation.

Namespace

Drupal\Tests\node\FunctionalJavascript

Code

protected function testPromotedContentCacheInvalidation() : void {
  // Create a new node, this invalidates the node_list cache tag. Need to reset
  // the cache tag checksum service as it did not register a need to
  // invalidate that again.
  \Drupal::service('cache_tags.invalidator.checksum')->reset();
  $this->drupalCreateNode([
    'type' => 'test_content',
    'title' => 'new page 2',
  ]);
  // Visit the promoted content page again.
  $performance_data = $this->collectPerformanceData(function () {
    $this->drupalGet('node');
  }, 'nodePromotedContentAfterInvalidation');
  $this->assertQueriesByName('nodePromotedContentAfterInvalidation', $performance_data->getQueries());
  $this->assertMetricsByName('nodePromotedContentAfterInvalidation', $performance_data);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.