Problem/Motivation

The test class in core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php uses a regular database query instead of using an entity query.

Proposed resolution

Replace the regular database query with an entity query.

Remaining tasks

TBD

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

TBD

CommentFileSizeAuthor
#9 3151981-9.patch609 bytesdaffie
#2 3151981-2.patch1.34 KBdaffie

Comments

daffie created an issue. See original summary.

daffie’s picture

Status: Active » Needs review
StatusFileSize
new1.34 KB

Patch changes the db query to an entity query.

hardik_patel_12’s picture

Status: Needs review » Reviewed & tested by the community

Verified this patch on local. Looks good to me.

pratik_kamble’s picture

Issue tags: +Bug Smash Initiative
pratik_kamble’s picture

Issue tags: -Bug Smash Initiative

  • catch committed cf1010f on 9.1.x
    Issue #3151981 by daffie: Replace the database query with an entity...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed cf1010f and pushed to 9.1.x. Thanks!

catch’s picture

Status: Fixed » Needs work
+++ b/core/modules/node/tests/src/Functional/NodeRevisionsAllTest.php
@@ -183,15 +183,17 @@ public function testRevisions() {
-      'Revision not found.');
+    $nids = \Drupal::entityQuery('node')
+      ->allRevisions()
+      ->condition('nid', $node->id())
+      ->condition('vid', $nodes[1]->getRevisionId())
+      ->execute();
+    $this->assertCount(0, $nids);

This needs an ->accessCheck(FALSE). We're querying what's in the database as opposed to what's available to the current user.

daffie’s picture

Status: Needs work » Needs review
StatusFileSize
new609 bytes

Adding the requested ->accessCheck(FALSE) to the EntityQuery.

hardik_patel_12’s picture

Status: Needs review » Reviewed & tested by the community

Back to RTBC , accessCheck is added to query as suggested by @catch.

  • catch committed 595c96e on 9.1.x
    Issue #3151981 by daffie, Hardik_Patel_12, catch: Replace the database...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed 595c96e and pushed to 9.1.x. Thanks!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.