function EntityWithoutBaseTableTest::setUp

Overrides KernelTestBase::setUp

File

core/modules/views/tests/src/Kernel/EntityWithoutBaseTableTest.php, line 44

Class

EntityWithoutBaseTableTest
Tests field views data in an edge case scenario.

Namespace

Drupal\Tests\views\Kernel

Code

protected function setUp() : void {
  parent::setUp();
  // This entity type doesn't have a data table.
  $this->installEntitySchema('entity_test_label');
  EntityTestHelper::createBundle(bundle: 'bundle_with_translatable_field', entity_type: 'entity_test_label');
  EntityTestHelper::createBundle(bundle: 'bundle_with_untranslatable_field', entity_type: 'entity_test_label');
  FieldStorageConfig::create([
    'entity_type' => 'entity_test_label',
    'type' => 'string',
    'field_name' => 'string_field',
    'translatable' => TRUE,
  ])->save();
  // This field instance is translatable.
  FieldConfig::create([
    'entity_type' => 'entity_test_label',
    'bundle' => 'bundle_with_translatable_field',
    'field_name' => 'string_field',
    'translatable' => TRUE,
  ])->save();
  // This field instance is not translatable.
  FieldConfig::create([
    'entity_type' => 'entity_test_label',
    'bundle' => 'bundle_with_untranslatable_field',
    'field_name' => 'string_field',
    'translatable' => FALSE,
  ])->save();
}

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