You are here

public function ArgumentNodeRevisionIdTest::testNodeRevisionRelationship in Drupal 9

Tests the node revision id argument via the node_vid handler.

File

core/modules/node/tests/src/Kernel/Views/ArgumentNodeRevisionIdTest.php, line 45

Class

ArgumentNodeRevisionIdTest
Tests the node_vid handler.

Namespace

Drupal\Tests\node\Kernel\Views

Code

public function testNodeRevisionRelationship() {
  NodeType::create([
    'type' => 'page',
    'name' => 'page',
  ])
    ->save();
  $node = Node::create([
    'type' => 'page',
    'title' => 'test1',
    'uid' => 1,
  ]);
  $node
    ->save();
  $node
    ->setNewRevision();
  $node
    ->setTitle('test2');
  $node
    ->save();
  $view_nid = Views::getView('test_node_revision_id_argument');
  $this
    ->executeView($view_nid, [
    $node
      ->getRevisionId(),
  ]);
  $this
    ->assertIdenticalResultset($view_nid, [
    [
      'title' => 'test2',
    ],
  ]);
}