You are here

protected function GroupContentQueryAccessHandlerTest::setUp in Group 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Kernel/GroupContentQueryAccessHandlerTest.php \Drupal\Tests\group\Kernel\GroupContentQueryAccessHandlerTest::setUp()

Overrides GroupKernelTestBase::setUp

File

tests/src/Kernel/GroupContentQueryAccessHandlerTest.php, line 47

Class

GroupContentQueryAccessHandlerTest
Tests the behavior of group content query access handler.

Namespace

Drupal\Tests\group\Kernel

Code

protected function setUp() {
  parent::setUp();

  // Create uid: 1 here so that it's skipped in test cases.
  $admin_user = $this
    ->createUser();
  $entity_type = $this->entityTypeManager
    ->getDefinition('group');
  $this->handler = GroupContentQueryAccessHandler::createInstance($this->container, $entity_type);

  // Create a group type where anonymous users have no access, authenticated
  // users can view group content and member users can update group content.
  $this->groupType = $this
    ->createGroupType();

  // Enable the test plugins on the group type.

  /** @var \Drupal\group\Entity\Storage\GroupContentTypeStorageInterface $storage */
  $storage = $this->entityTypeManager
    ->getStorage('group_content_type');
  $this->groupContentType = $storage
    ->createFromPlugin($this->groupType, 'user_as_content');
  $this->groupContentType
    ->save();
}