You are here

protected function OgStandardReferenceRelationshipTest::setUp in Organic groups 8

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/EntityReference/Views/OgStandardReferenceRelationshipTest.php, line 60

Class

OgStandardReferenceRelationshipTest
Tests OG standard reference relationship data.

Namespace

Drupal\Tests\og\Kernel\EntityReference\Views

Code

protected function setUp($import_test_views = TRUE) : void {
  parent::setUp();
  $this
    ->installEntitySchema('user');
  $this
    ->installEntitySchema('entity_test');
  $this
    ->installEntitySchema('entity_test_mul');

  // Create reference from entity_test to entity_test_mul.
  $settings = [
    'field_name' => 'field_test_data',
    'field_storage_config' => [
      'settings' => [
        'target_type' => 'entity_test_mul',
      ],
    ],
  ];
  Og::createField(OgGroupAudienceHelperInterface::DEFAULT_FIELD, 'entity_test', 'entity_test', $settings);

  // Create reference from entity_test_mul to entity_test.
  $settings = [
    'field_name' => 'field_data_test',
    'field_storage_config' => [
      'settings' => [
        'target_type' => 'entity_test',
      ],
    ],
  ];
  Og::createField(OgGroupAudienceHelperInterface::DEFAULT_FIELD, 'entity_test_mul', 'entity_test_mul', $settings);
  ViewTestData::createTestViews(get_class($this), [
    'og_standard_reference_test_views',
  ]);
}