You are here

public function Breadcrumb404Test::testBreadcrumbOn404Pages in Drupal 10

Same name and namespace in other branches
  1. 8 core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php \Drupal\FunctionalTests\Breadcrumb\Breadcrumb404Test::testBreadcrumbOn404Pages()
  2. 9 core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php \Drupal\FunctionalTests\Breadcrumb\Breadcrumb404Test::testBreadcrumbOn404Pages()

Tests that different 404s don't create unnecessary cache entries.

File

core/tests/Drupal/FunctionalTests/Breadcrumb/Breadcrumb404Test.php, line 30

Class

Breadcrumb404Test
Tests the breadcrumb of 404 pages.

Namespace

Drupal\FunctionalTests\Breadcrumb

Code

public function testBreadcrumbOn404Pages() {
  $this
    ->placeBlock('system_breadcrumb_block', [
    'id' => 'breadcrumb',
  ]);

  // Prime the cache first.
  $this
    ->drupalGet('/not-found-1');
  $base_count = count($this
    ->getBreadcrumbCacheEntries());
  $this
    ->drupalGet('/not-found-2');
  $next_count = count($this
    ->getBreadcrumbCacheEntries());
  $this
    ->assertEquals($base_count, $next_count);
  $this
    ->drupalGet('/not-found-3');
  $next_count = count($this
    ->getBreadcrumbCacheEntries());
  $this
    ->assertEquals($base_count, $next_count);
}