public function OgAccessEntityTest::testAccessByPermission in Organic groups 8
Tests access to an entity by different permissions.
@coversDefaultmethod ::userAccessEntity @dataProvider permissionsProvider
File
- tests/
src/ Unit/ OgAccessEntityTest.php, line 21
Class
- OgAccessEntityTest
- OG Access entity tests.
Namespace
Drupal\Tests\og\UnitCode
public function testAccessByPermission($permission) {
$this->membershipManager
->getGroups($this->groupContentEntity
->reveal())
->willReturn([
$this->entityTypeId => [
$this->group,
],
]);
$user_access = $this->ogAccess
->userAccessEntity($permission, $this->groupContentEntity
->reveal(), $this->user
->reveal());
// We populate the allowed permissions cache in
// OgAccessEntityTestBase::setup().
$condition = $permission == 'update group' ? $user_access
->isAllowed() : $user_access
->isNeutral();
$this
->assertTrue($condition);
}