verifyPageCacheContainsTags example

$referencing_node = $this->createNode([
      'type' => 'bundle_with_reference_field',
      'title' => 'The referencing node title',
      'field_reference' => ['entity' => $referenced_node],
    ]);

    // When user does not have view access to referenced entities in entity     // reference field blocks, test that the cache tags of the referenced entity     // are still bubbled to page cache.     $referencing_node_url = $referencing_node->toUrl();
    $this->verifyPageCacheContainsTags($referencing_node_url, 'MISS');
    $this->verifyPageCacheContainsTags($referencing_node_url, 'HIT', $referenced_node->getCacheTags());
    // Since the referenced node is inaccessible, it should not appear on the     // referencing node.     $this->drupalGet($referencing_node_url);
    $assert_session->linkNotExists('The referenced node title');

    // Publish the referenced entity.     $referenced_node->setPublished()
      ->save();

    // Revisit the node with the reference field without clearing cache. Now
Home | Imprint | This part of the site doesn't use cookies.