function NodeAccessRebuildNodeGrantsTest::testNodeAccessRebuildNoAccessModules
Same name in other branches
- 9 core/modules/node/tests/src/Functional/NodeAccessRebuildNodeGrantsTest.php \Drupal\Tests\node\Functional\NodeAccessRebuildNodeGrantsTest::testNodeAccessRebuildNoAccessModules()
- 10 core/modules/node/tests/src/Functional/NodeAccessRebuildNodeGrantsTest.php \Drupal\Tests\node\Functional\NodeAccessRebuildNodeGrantsTest::testNodeAccessRebuildNoAccessModules()
- 11.x core/modules/node/tests/src/Functional/NodeAccessRebuildNodeGrantsTest.php \Drupal\Tests\node\Functional\NodeAccessRebuildNodeGrantsTest::testNodeAccessRebuildNoAccessModules()
Tests rebuilding the node access permissions table with no content.
File
-
core/
modules/ node/ tests/ src/ Functional/ NodeAccessRebuildNodeGrantsTest.php, line 109
Class
- NodeAccessRebuildNodeGrantsTest
- Ensures that node access rebuild functions work correctly even when other modules implements hook_node_grants().
Namespace
Drupal\Tests\node\FunctionalCode
public function testNodeAccessRebuildNoAccessModules() {
// Default realm access is present.
$this->assertEqual(1, \Drupal::service('node.grant_storage')->count(), 'There is an all realm access record');
// No need to rebuild permissions.
$this->assertNull(\Drupal::state()->get('node.node_access_needs_rebuild'), 'Node access permissions need to be rebuilt');
// Rebuild permissions.
$this->drupalGet('admin/reports/status');
$this->clickLink(t('Rebuild permissions'));
$this->drupalPostForm(NULL, [], t('Rebuild permissions'));
$this->assertText(t('Content permissions have been rebuilt.'));
$this->assertNull(\Drupal::state()->get('node.node_access_needs_rebuild'), 'Node access permissions have been rebuilt');
// Default realm access is still present.
$this->assertEqual(1, \Drupal::service('node.grant_storage')->count(), 'There is an all realm access record');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.