function ViewsNodeRevisionRelationsTestCase::testNodeRevisionRelationship
Create a node with revision and rest result count for both views.
File
-
tests/
node/ views_node_revision_relations.test, line 27
Class
- ViewsNodeRevisionRelationsTestCase
- Tests basic node_revision table integration into views.
Code
public function testNodeRevisionRelationship() {
$node = $this->drupalCreateNode();
// Create revision of the node.
$node_revision = clone $node;
$node_revision->revision = 1;
node_save($node_revision);
$column_map = array(
'vid' => 'vid',
'node_revision_nid' => 'node_revision_nid',
'node_node_revision_nid' => 'node_node_revision_nid',
);
// Here should be two rows.
$view_nid = $this->test_view_node_revision_nid();
$this->executeView($view_nid, array(
$node->nid,
));
$resultset_nid = array(
array(
'vid' => '1',
'node_revision_nid' => '1',
'node_node_revision_nid' => '1',
),
array(
'vid' => '2',
'node_revision_nid' => '1',
'node_node_revision_nid' => '1',
),
);
$this->assertIdenticalResultset($view_nid, $resultset_nid, $column_map);
// There should be only one row with active revision 2.
$view_vid = $this->test_view_node_revision_vid();
$this->executeView($view_vid, array(
$node->nid,
));
$resultset_vid = array(
array(
'vid' => '2',
'node_revision_nid' => '1',
'node_node_revision_nid' => '1',
),
);
$this->assertIdenticalResultset($view_vid, $resultset_vid, $column_map);
}