You are here

protected function EntityQueryAlterComplexTest::setUp in Group 8

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

Overrides GroupKernelTestBase::setUp

File

tests/src/Kernel/EntityQueryAlterComplexTest.php, line 53

Class

EntityQueryAlterComplexTest
Tests that Group properly checks access for "complex" grouped entities.

Namespace

Drupal\Tests\group\Kernel

Code

protected function setUp() {
  parent::setUp();
  $this
    ->installConfig('group_test_plugin');
  $this
    ->installSchema('node', [
    'node_access',
  ]);
  $this
    ->installEntitySchema('node');
  $this->storage = $this->entityTypeManager
    ->getStorage('node');
  $this
    ->createNodeType([
    'type' => 'page',
  ]);
  $this
    ->createNodeType([
    'type' => 'article',
  ]);
  $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, 'node_as_content:page'));
  $storage
    ->save($storage
    ->createFromPlugin($this->groupTypeA, 'node_as_content:article'));
  $storage
    ->save($storage
    ->createFromPlugin($this->groupTypeB, 'node_as_content:page'));
  $storage
    ->save($storage
    ->createFromPlugin($this->groupTypeB, 'node_as_content:article'));
}