You are here

public function GroupCheckTest::testNotGroupType in Organic groups 8

Tests an entity that is not of group type.

@covers ::access

File

tests/src/Unit/GroupCheckTest.php, line 189

Class

GroupCheckTest
Tests the group check access.

Namespace

Drupal\Tests\og\Unit

Code

public function testNotGroupType() {
  $this->entityTypeManager
    ->getDefinition($this->entityTypeId, FALSE)
    ->willReturn($this->entityType);
  $this->entityTypeManager
    ->getStorage($this->entityTypeId)
    ->willReturn($this->entityStorage);
  $this->entityStorage
    ->load($this->entityId)
    ->willReturn($this->group
    ->reveal());
  $this->group
    ->bundle()
    ->willReturn($this->bundle);
  $this->groupTypeManager
    ->isGroup($this->entityTypeId, $this->bundle)
    ->willReturn(FALSE);
  $result = $this
    ->getAccessResult();
  $this
    ->assertTrue($result
    ->isForbidden());
}