You are here

protected function GroupContentAccessControlHandlerTest::setUp in Group 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Unit/GroupContentAccessControlHandlerTest.php \Drupal\Tests\group\Unit\GroupContentAccessControlHandlerTest::setUp()

Overrides UnitTestCase::setUp

File

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

Class

GroupContentAccessControlHandlerTest
Tests the group content 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->groupRelationManager = $this
    ->prophesize(GroupRelationManagerInterface::class);
  $moduleHandler = $this
    ->prophesize(ModuleHandlerInterface::class);
  $moduleHandler
    ->invokeAll(Argument::cetera())
    ->willReturn([]);
  $container = $this
    ->prophesize(ContainerInterface::class);
  $container
    ->get('entity_type.manager')
    ->willReturn($this->entityTypeManager
    ->reveal());
  $container
    ->get('plugin.manager.group_relation')
    ->willReturn($this->groupRelationManager
    ->reveal());
  $container
    ->get('module_handler')
    ->willReturn($moduleHandler
    ->reveal());
  \Drupal::setContainer($container
    ->reveal());
  $entityType = $this
    ->prophesize(EntityTypeInterface::class);
  $this->accessControlHandler = GroupContentAccessControlHandler::createInstance($container
    ->reveal(), $entityType
    ->reveal());
}