You are here

protected function EntityAccessTest::setUp in Group 8

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

Overrides GroupKernelTestBase::setUp

File

tests/src/Kernel/EntityAccessTest.php, line 48

Class

EntityAccessTest
Tests that Group properly checks access for grouped entities.

Namespace

Drupal\Tests\group\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installEntitySchema('entity_test_with_owner');
  $this->storage = $this->entityTypeManager
    ->getStorage('entity_test_with_owner');
  $this->accessControlHandler = $this->entityTypeManager
    ->getAccessControlHandler('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',
  ]));
}