assertPageCacheContextsAndTags example

'url.query_args:' . MainContentViewSubscriber::WRAPPER_FORMAT,
      // rel=canonical links and friends have absolute URLs as their values.       'url.site',
      // These two cache contexts are added by BigPipe.       'cookies:big_pipe_nojs',
      'session.exists',
      'user.permissions',
      'user.roles:authenticated',
    ];

    // Full node page 1.     $this->assertPageCacheContextsAndTags($node_1->toUrl()$cache_contexts[
      'http_response',
      'rendered',
      'block_view',
      'local_task',
      'config:block_list',
      'config:block.block.olivero_site_branding',
      'config:block.block.olivero_breadcrumbs',
      'config:block.block.olivero_content',
      'config:block.block.olivero_help',
      'config:block.block.olivero_search_form_narrow',
      'config:block.block.olivero_search_form_wide',
      
// Check that the amount of nodes per char.     foreach ($view->result as $item) {
      $this->assertEquals($nodes_per_char[$item->title_truncated]$item->num_records);
    }

    // Enable the glossary to be displayed.     $view->storage->enable()->save();
    $this->container->get('router.builder')->rebuildIfNeeded();
    $url = Url::fromRoute('view.glossary.page_1');

    // Verify cache tags.     $this->assertPageCacheContextsAndTags(
      $url,
      [
        'timezone',
        'languages:' . LanguageInterface::TYPE_CONTENT,
        'languages:' . LanguageInterface::TYPE_INTERFACE,
        'theme',
        'url',
        'user.node_grants:view',
        'user.permissions',
        'route',
      ],
      [


    $render_cache_tags = Cache::mergeTags($empty_node_listing_cache_tags$cache_context_tags);
    $this->assertViewsCacheTags(
      $view,
      $empty_node_listing_cache_tags,
      $do_assert_views_caches,
      $render_cache_tags
    );
    $expected_tags = Cache::mergeTags($empty_node_listing_cache_tags$cache_context_tags);
    $expected_tags = Cache::mergeTags($expected_tags['http_response', 'rendered', 'config:user.role.anonymous']);
    $this->assertPageCacheContextsAndTags(
      Url::fromRoute('view.frontpage.page_1'),
      $cache_contexts,
      $expected_tags
    );

    // Create some nodes on the frontpage view. Add more than 10 nodes in order     // to enable paging.     $this->drupalCreateContentType(['type' => 'article']);
    for ($i = 0; $i < 15; $i++) {
      $node = Node::create([
        'body' => [
          [
Home | Imprint | This part of the site doesn't use cookies.