You are here

protected function EntityQueryAlterTest::setUp in Group 8

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

Overrides GroupKernelTestBase::setUp

File

tests/src/Kernel/EntityQueryAlterTest.php, line 49

Class

EntityQueryAlterTest
Tests that Group properly checks access for grouped entities.

Namespace

Drupal\Tests\group\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installConfig('group_test_plugin');
  $this
    ->installEntitySchema('entity_test_with_owner');
  $this->storage = $this->entityTypeManager
    ->getStorage('entity_test_with_owner');
  $this->groupTypeA = $this
    ->createGroupType([
    'id' => 'foo',
    'creator_membership' => FALSE,
  ]);
  $this->groupTypeB = $this
    ->createGroupType([
    'id' => 'bar',
    'creator_membership' => FALSE,
  ]);

  /** @var \Drupal\group\Entity\Storage\GroupContentTypeStorageInterface $storage */
  $storage = $this->entityTypeManager
    ->getStorage('group_content_type');
  $storage
    ->save($storage
    ->createFromPlugin($this->groupTypeA, 'entity_test_as_content'));
  $storage
    ->save($storage
    ->createFromPlugin($this->groupTypeB, 'entity_test_as_content'));
  $this
    ->setCurrentUser($this
    ->createUser([], [
    'administer entity_test_with_owner content',
  ]));
}