function NodeAccessTest::testDuplicateBatchRebuild

Tests that multiple calls to node_access_rebuild only result in one batch.

File

core/modules/node/tests/src/Kernel/NodeAccessTest.php, line 162

Class

NodeAccessTest
Tests basic node_access functionality.

Namespace

Drupal\Tests\node\Kernel

Code

public function testDuplicateBatchRebuild() : void {
  $this->enableModules([
    'node_access_test',
  ]);
  $batch = batch_get();
  $this->assertEmpty($batch);
  node_access_rebuild(TRUE);
  $batch = batch_get();
  $this->assertCount(1, $batch['sets']);
  node_access_rebuild(TRUE);
  $batch = batch_get();
  $this->assertCount(1, $batch['sets']);
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.