You are here

protected function GroupContentEntityAccessControlHandlerTest::setUp in Group 8

Overrides UnitTestCase::setUp

File

tests/src/Unit/GroupContentEntityAccessControlHandlerTest.php, line 62

Class

GroupContentEntityAccessControlHandlerTest
Tests the group content entity access control handler.

Namespace

Drupal\Tests\group\Unit

Code

protected function setUp() {
  parent::setUp();
  $this->account = $this
    ->prophesize(AccountInterface::class);
  $this->account
    ->id()
    ->willReturn(1986);
  $this->entityTypeManager = $this
    ->prophesize(EntityTypeManagerInterface::class);
  $this->groupContentEnablerManager = $this
    ->prophesize(GroupContentEnablerManagerInterface::class);
  $moduleHandler = $this
    ->prophesize(ModuleHandlerInterface::class);
  $moduleHandler
    ->invokeAll(Argument::cetera())
    ->willReturn([]);
  $entity_type_repository = $this
    ->prophesize(EntityTypeRepositoryInterface::class);
  $entity_type_repository
    ->getEntityTypeFromClass(Argument::any())
    ->willReturn('group_content_type');
  $container = $this
    ->prophesize(ContainerInterface::class);
  $container
    ->get('entity_type.manager')
    ->willReturn($this->entityTypeManager
    ->reveal());
  $container
    ->get('entity_type.repository')
    ->willReturn($entity_type_repository
    ->reveal());
  $container
    ->get('plugin.manager.group_content_enabler')
    ->willReturn($this->groupContentEnablerManager
    ->reveal());
  $container
    ->get('module_handler')
    ->willReturn($moduleHandler
    ->reveal());
  \Drupal::setContainer($container
    ->reveal());
  $entityType = $this
    ->prophesize(EntityTypeInterface::class);
  $this->accessControlHandler = new GroupContentAccessControlHandler($entityType
    ->reveal());
}