You are here

protected function GroupAudienceTest::setUp in Organic groups 8

Overrides KernelTestBase::setUp

File

tests/src/Kernel/Entity/GroupAudienceTest.php, line 48

Class

GroupAudienceTest
Tests the group audience field.

Namespace

Drupal\Tests\og\Kernel\Entity

Code

protected function setUp() : void {
  parent::setUp();

  // Add membership and config schema.
  $this
    ->installConfig([
    'og',
  ]);
  $this
    ->installEntitySchema('entity_test');
  $this
    ->installEntitySchema('og_membership');
  $this
    ->installEntitySchema('user');
  $this->groupAudienceHelper = $this->container
    ->get('og.group_audience_helper');

  // Create several bundles.
  for ($i = 0; $i <= 4; $i++) {
    $bundle = EntityTest::create([
      'type' => mb_strtolower($this
        ->randomMachineName()),
      'name' => $this
        ->randomString(),
    ]);
    $bundle
      ->save();
    $this->bundles[] = $bundle
      ->id();
  }
}