diff --git a/core/modules/node/tests/src/Kernel/NodeAccessRecordsTest.php b/core/modules/node/tests/src/Kernel/NodeAccessRecordsTest.php
index c2375cccdd5..e0b11742c6b 100644
--- a/core/modules/node/tests/src/Kernel/NodeAccessRecordsTest.php
+++ b/core/modules/node/tests/src/Kernel/NodeAccessRecordsTest.php
@@ -6,6 +6,7 @@
 
 use Drupal\Core\Database\Database;
 use Drupal\node\Entity\Node;
+use Drupal\node_test\Hook\NodeTestHooks;
 
 /**
  * Tests hook_node_access_records when acquiring grants.
@@ -88,7 +89,8 @@ public function testNodeAccessRecords(): void {
     // Create a user that is allowed to access content.
     $web_user = $this->drupalCreateUser(['access content']);
     foreach ($operations as $op) {
-      $grants = node_test_node_grants($web_user, $op);
+      $nodeTestHook = new NodeTestHooks;
+      $grants = $nodeTestHook->nodeGrants($web_user, $op);
       $altered_grants = $grants;
       \Drupal::moduleHandler()->alter('node_grants', $altered_grants, $web_user, $op);
       $this->assertNotEquals($grants, $altered_grants, "Altered the $op grant for a user.");
