You are here

protected function OgAdminMembersViewTest::setUpFixtures in Organic groups 8

Sets up the configuration and schema of views and views_test_data modules.

Because the schema of views_test_data.module is dependent on the test using it, it cannot be enabled normally.

Overrides ViewsKernelTestBase::setUpFixtures

File

tests/src/Kernel/Views/OgAdminMembersViewTest.php, line 96

Class

OgAdminMembersViewTest
Tests the OG admin Members view.

Namespace

Drupal\Tests\og\Kernel\Views

Code

protected function setUpFixtures() {

  // Add membership and config schema.
  $this
    ->installConfig([
    'og',
  ]);
  $this
    ->installEntitySchema('og_membership');
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('node');

  // Create a group entity type.
  $group_bundle = mb_strtolower($this
    ->randomMachineName());
  NodeType::create([
    'type' => $group_bundle,
    'name' => $this
      ->randomString(),
  ])
    ->save();
  Og::groupTypeManager()
    ->addGroup('node', $group_bundle);

  // Create group admin user.
  $this->user = $this
    ->createUser([
    'access user profiles',
  ], FALSE, TRUE);

  // Create a group.
  $this->group = Node::create([
    'title' => $this
      ->randomString(),
    'type' => $group_bundle,
    'uid' => $this->user
      ->id(),
  ]);
  $this->group
    ->save();
  parent::setUpFixtures();
}