You are here

protected function GroupIdArgumentTest::setUp in Group 8

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

Parameters

bool $import_test_views: Should the views specified on the test class be imported. If you need to setup some additional stuff, like fields, you need to call false and then call createTestViews for your own.

Overrides ViewsKernelTestBase::setUp

File

tests/src/Kernel/Views/GroupIdArgumentTest.php, line 35

Class

GroupIdArgumentTest
Tests the group_id argument handler.

Namespace

Drupal\Tests\group\Kernel\Views

Code

protected function setUp($import_test_views = TRUE) {
  parent::setUp($import_test_views);
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('group');
  $this
    ->installEntitySchema('group_type');
  $this
    ->installEntitySchema('group_content');
  $this
    ->installEntitySchema('group_content_type');
  $this
    ->installConfig([
    'group',
    'field',
    'group_test_config',
  ]);

  // Set the current user so group creation can rely on it.
  $account = User::create([
    'name' => $this
      ->randomString(),
  ]);
  $account
    ->save();
  $this->container
    ->get('current_user')
    ->setAccount($account);
  ViewTestData::createTestViews(get_class($this), [
    'group_test_views',
  ]);
}