public function OgAccessHookTest::testEntityOperationAccess in Organic groups 8
Tests access to entity operations through the access hook.
@dataProvider entityOperationAccessProvider
Parameters
string $user: The name of the user to test.
array $expected_results: An associative array indicating whether the user should have the right to edit content owned by the user represented by the array key.
File
- tests/src/ Kernel/ Access/ OgAccessHookTest.php, line 205 
Class
- OgAccessHookTest
- Tests access through OG's implementation of hook_entity_access().
Namespace
Drupal\Tests\og\Kernel\AccessCode
public function testEntityOperationAccess($user, array $expected_results) {
  foreach ($expected_results as $group_content => $expected_result) {
    /** @var \Drupal\Core\Access\AccessResult $result */
    $result = og_entity_access($this->groupContent[$group_content], 'update', $this->users[$user]);
    $this
      ->assertEquals($expected_result, $result
      ->isAllowed());
  }
  $result = og_entity_access($this->nonGroupContent, 'update', $this->users['member']);
  $this
    ->assertEquals(TRUE, $result
    ->isNeutral());
}