Problem/Motivation

The test class in core/modules/node/tests/src/Functional/NodeAccessBaseTableTest.php uses regular database queries instead of using entity queries.

Proposed resolution

Replace the regular database queries with an entity queries.

Remaining tasks

TBD

User interface changes

None

API changes

None

Data model changes

None

Release notes snippet

TBD

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

daffie created an issue. See original summary.

daffie’s picture

Status: Active » Needs review
FileSize
1.44 KB

Patch changes the db queries to entity queries.

snehalgaikwad’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
60.54 KB

Verified this patch on local. Looks good to me.

munish.kumar’s picture

Status: Reviewed & tested by the community » Needs review
FileSize
1.58 KB
430 bytes

Hi @snehalgaikwad, I have reviewed the latest patch It has one coding standard-issue, So removing the unused use statement in this patch. So moving back to NR.

daffie’s picture

Status: Needs review » Reviewed & tested by the community

@munish.kumar: Good find!

Back to RTBC.

pratik_kamble’s picture

Issue tags: +Bug Smash Initiative
pratik_kamble’s picture

Issue tags: -Bug Smash Initiative
catch’s picture

Status: Reviewed & tested by the community » Needs work
+++ b/core/modules/node/tests/src/Functional/NodeAccessBaseTableTest.php
@@ -128,9 +127,17 @@ public function testNodeAccessBasic() {
-    $this->privateTid = $connection->query('SELECT tid FROM {taxonomy_term_field_data} WHERE name = :name AND default_langcode = 1', [':name' => 'private'])->fetchField();
+    $public_tids = \Drupal::entityQuery('taxonomy_term')
+      ->condition('name', 'public')
+      ->condition('default_langcode', 1)
+      ->execute();
+    $this->publicTid = reset($public_tids);
+    $private_tids = \Drupal::entityQuery('taxonomy_term')
+      ->condition('name', 'private')
+      ->condition('default_langcode', 1)
+      ->execute();

These need ->accessCheck(FALSE)

narendra.rajwar27’s picture

Assigned: Unassigned » narendra.rajwar27

working on it

narendra.rajwar27’s picture

Assigned: narendra.rajwar27 » Unassigned
Status: Needs work » Needs review
FileSize
1.63 KB
747 bytes

Patch updated as per comment #8,
Please review.

daffie’s picture

Status: Needs review » Reviewed & tested by the community

Change looks like what @catch requested.
Back to RTBC.

  • catch committed cb71f42 on 9.1.x
    Issue #3152001 by narendra.rajwar27, munish.kumar, daffie, snehalgaikwad...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed cb71f42 and pushed to 9.1.x. Thanks!

Status: Fixed » Closed (fixed)

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