// Default realm access and node records are present.
$this->assertTrue(\Drupal::service('node.grant_storage')->access($node,'view',$this->webUser),'The expected node access records are present');
foreach($nodesas$node){
$this->assertTrue($node->private->value);
$this->assertTrue($grant_storage->access($node,'view',$this->webUser)->isAllowed(),'Prior to rebuilding node access the grant storage returns allowed for the node author.');
$this->assertTrue($grant_storage->access($node,'view',$this->adminUser)->isAllowed(),'Prior to rebuilding node access the grant storage returns allowed for the admin user.');
}
$this->assertEqual(1,\Drupal::service('node.grant_storage')->checkAll($this->webUser),'There is an all realm access record');
$this->assertTrue(\Drupal::state()->get('node.node_access_needs_rebuild'),'Node access permissions need to be rebuilt');
$this->assertNull(\Drupal::state()->get('node.node_access_needs_rebuild'),'Node access permissions have been rebuilt');
$this->assertTrue(\Drupal::service('node.grant_storage')->access($node,'view',$this->webUser),'The expected node access records are present');
foreach($nodesas$node){
$this->assertTrue($grant_storage->access($node,'view',$this->webUser)->isAllowed(),'After rebuilding node access the grant storage returns allowed for the node author.');
$this->assertFalse($grant_storage->access($node,'view',$this->adminUser)->isForbidden(),'After rebuilding node access the grant storage returns forbidden for the admin user.');
}
$this->assertFalse(\Drupal::service('node.grant_storage')->checkAll($this->webUser),'There is no all realm access record');
// Test an anonymous node access rebuild from code.
$this->drupalLogout();
node_access_rebuild();
foreach($nodesas$node){
$this->assertTrue($grant_storage->access($node,'view',$this->webUser)->isAllowed(),'After rebuilding node access the grant storage returns allowed for the node author.');
$this->assertFalse($grant_storage->access($node,'view',$this->adminUser)->isForbidden(),'After rebuilding node access the grant storage returns forbidden for the admin user.');
}
$this->assertFalse(\Drupal::service('node.grant_storage')->checkAll($this->webUser),'There is no all realm access record');