You are here

public function EntityQueueCacheTagsTest::testViewWithRelationship in Entityqueue 8

Tests the cache tags of a view with a entity queue relationship.

File

tests/src/Kernel/EntityQueueCacheTagsTest.php, line 45

Class

EntityQueueCacheTagsTest
Tests cache tags of entity queues.

Namespace

Drupal\Tests\entityqueue\Kernel

Code

public function testViewWithRelationship() {
  $nodes = [];
  $node = $this
    ->createNode([
    'type' => 'article',
    'title' => 'Test article (1)',
  ]);
  $node
    ->save();
  $nodes[] = $node;
  $node = $this
    ->createNode([
    'type' => 'article',
    'title' => 'Test article (2)',
  ]);
  $node
    ->save();
  $nodes[] = $node;
  $entity_subqueue = EntitySubqueue::load('simple_queue');
  $entity_subqueue
    ->set('items', $nodes);
  $entity_subqueue
    ->save();
  $build = [
    '#type' => 'view',
    '#name' => 'simple_queue_listing',
  ];
  $renderer = $this->container
    ->get('bare_html_page_renderer');
  $response = $renderer
    ->renderBarePage($build, '', 'maintenance_page');
  $this
    ->assertEquals([
    'config:entityqueue.entity_queue.simple_queue',
    'config:views.view.simple_queue_listing',
    'entity_field_info',
    'entity_subqueue:simple_queue',
    'entity_subqueue_list',
    'node:1',
    'node:2',
    'node_list',
    'views_data',
  ], $response
    ->getCacheableMetadata()
    ->getCacheTags());
}