public function EntityReferenceBrowserTableWidgetTests::setUp in Entity Browser - Table Layout 8
Overrides KernelTestBase::setUp
File
- tests/
src/ Kernel/ EntityReferenceBrowserTableWidgetTests.php, line 44
Class
Namespace
Drupal\entity_browser_table\KernelCode
public function setUp() {
parent::setUp();
// TODO: Change the autogenerated stub
$this
->installEntitySchema('taxonomy_term');
$this
->installConfig('media');
// Install the United Kingdowm Language.
$language = ConfigurableLanguage::createFromLangcode('en-gb');
$language
->save();
$fieldStorage = $this
->createMock(FieldStorageConfig::class);
$fieldStorage
->method('getSetting')
->willReturn('media');
$fieldDefinition = $this
->createMock(FieldDefinitionInterface::class);
$fieldDefinition
->method('getFieldStorageDefinition')
->willReturn($fieldStorage);
$configuration = [
'field_definition' => $fieldDefinition,
'settings' => [],
'third_party_settings' => [],
];
$this->widget = EntityReferenceBrowserTableWidget::create($this->container, $configuration, $this
->randomString(), []);
$this->entities = [
Media::create([
'bundle' => 'image',
'name' => $this
->randomString(),
'field_brands' => [
[
'target_id' => 1,
],
],
]),
Media::create([
'bundle' => 'image',
'name' => $this
->randomString(),
'field_brands' => 2,
]),
Media::create([
'bundle' => 'file',
'name' => $this
->randomString(),
'field_brands' => 3,
]),
];
$this->detailsId = $this
->randomString();
$this->fieldParents = [
$this
->randomString(),
$this
->randomString(),
];
$this->rowId = $this
->randomString();
}