You are here

public function OgAccessEntityTest::testAccessByPermissionAdmin in Organic groups 8

Tests access to an entity by different permissions, by an admin member.

@coversDefaultmethod ::userAccessEntity @dataProvider permissionsProvider

File

tests/src/Unit/OgAccessEntityTest.php, line 38

Class

OgAccessEntityTest
OG Access entity tests.

Namespace

Drupal\Tests\og\Unit

Code

public function testAccessByPermissionAdmin($permission) {
  $this->membershipManager
    ->getGroups($this->groupContentEntity
    ->reveal())
    ->willReturn([
    $this->entityTypeId => [
      $this->group,
    ],
  ]);
  $this->user
    ->hasPermission('administer organic groups')
    ->willReturn(TRUE);
  $user_entity_access = $this->ogAccess
    ->userAccessEntity($permission, $this->groupContentEntity
    ->reveal(), $this->user
    ->reveal());
  $this
    ->assertTrue($user_entity_access
    ->isAllowed());
}