Issue #3151975 by daffie, narendra.rajwar27: Replace the database query with an entity query in NodeRevisionsTest

merge-requests/2/head
Alex Pott 2020-07-14 11:06:36 +01:00
parent 49dc61d485
commit 702e824664
No known key found for this signature in database
GPG Key ID: 31905460D4A69276
1 changed files with 7 additions and 2 deletions

View File

@ -197,8 +197,13 @@ class NodeRevisionsTest extends NodeTestBase {
'%title' => $nodes[1]->label(), '%title' => $nodes[1]->label(),
]), 'Revision deleted.'); ]), 'Revision deleted.');
$connection = Database::getConnection(); $connection = Database::getConnection();
$this->assertTrue($connection->query('SELECT COUNT(vid) FROM {node_revision} WHERE nid = :nid and vid = :vid', [':nid' => $node->id(), ':vid' => $nodes[1]->getRevisionId()])->fetchField() == 0, 'Revision not found.'); $nids = \Drupal::entityQuery('node')
$this->assertTrue($connection->query('SELECT COUNT(vid) FROM {node_field_revision} WHERE nid = :nid and vid = :vid', [':nid' => $node->id(), ':vid' => $nodes[1]->getRevisionId()])->fetchField() == 0, 'Field revision not found.'); ->accessCheck(FALSE)
->allRevisions()
->condition('nid', $node->id())
->condition('vid', $nodes[1]->getRevisionId())
->execute();
$this->assertCount(0, $nids);
// Set the revision timestamp to an older date to make sure that the // Set the revision timestamp to an older date to make sure that the
// confirmation message correctly displays the stored revision date. // confirmation message correctly displays the stored revision date.