You are here

protected function OgComplexWidgetTest::setUp in Organic groups 8

Overrides BrowserTestBase::setUp

File

tests/src/Functional/OgComplexWidgetTest.php, line 39

Class

OgComplexWidgetTest
Tests the complex widget.

Namespace

Drupal\Tests\og\Functional

Code

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

  // Create a "group" bundle on the Custom Block entity type and turn it into
  // a group. Note we're not using the Entity Test entity for this since it
  // does not have real support for multiple bundles.
  BlockContentType::create([
    'id' => 'group',
  ])
    ->save();
  Og::groupTypeManager()
    ->addGroup('block_content', 'group');

  // Add a group audience field to the "post" node type, turning it into a
  // group content type.
  $this
    ->createContentType([
    'type' => 'post',
  ]);
  $settings = [
    'field_storage_config' => [
      'settings' => [
        'target_type' => 'block_content',
      ],
    ],
  ];
  Og::createField(OgGroupAudienceHelperInterface::DEFAULT_FIELD, 'node', 'post', $settings);
}