function WorkspaceViewsIntegrationTest::setUp

Same name in other branches
  1. 10 core/modules/workspaces/tests/src/Kernel/WorkspaceViewsIntegrationTest.php \Drupal\Tests\workspaces\Kernel\WorkspaceViewsIntegrationTest::setUp()

Overrides ViewsKernelTestBase::setUp

File

core/modules/workspaces/tests/src/Kernel/WorkspaceViewsIntegrationTest.php, line 63

Class

WorkspaceViewsIntegrationTest
Tests the views integration for workspaces.

Namespace

Drupal\Tests\workspaces\Kernel

Code

protected function setUp($import_test_views = TRUE) : void {
    parent::setUp(FALSE);
    $this->entityTypeManager = \Drupal::entityTypeManager();
    $this->installEntitySchema('entity_test_mulrevpub');
    $this->installEntitySchema('node');
    $this->installEntitySchema('user');
    $this->installEntitySchema('workspace');
    $this->installConfig([
        'filter',
        'node',
        'system',
        'language',
        'content_translation',
    ]);
    $this->installSchema('node', [
        'node_access',
    ]);
    $this->installSchema('workspaces', [
        'workspace_association',
    ]);
    $language = ConfigurableLanguage::createFromLangcode('ro');
    $language->save();
    $this->createContentType([
        'type' => 'page',
    ]);
    $this->container
        ->get('content_translation.manager')
        ->setEnabled('node', 'page', TRUE);
    // Create an entity reference field, in order to test relationship queries.
    FieldStorageConfig::create([
        'entity_type' => 'node',
        'type' => 'entity_reference',
        'field_name' => 'field_reference',
        'settings' => [
            'target_type' => 'entity_test_mulrevpub',
        ],
    ])->save();
    FieldConfig::create([
        'entity_type' => 'node',
        'bundle' => 'page',
        'field_name' => 'field_reference',
    ])->save();
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.