protected function EntityFormWidgetTest::setUp in Entity Browser 8
Same name and namespace in other branches
- 8.2 modules/entity_form/tests/src/FunctionalJavascript/EntityFormWidgetTest.php \Drupal\Tests\entity_browser_entity_form\FunctionalJavascript\EntityFormWidgetTest::setUp()
Overrides BrowserTestBase::setUp
File
- modules/
entity_form/ tests/ src/ FunctionalJavascript/ EntityFormWidgetTest.php, line 42
Class
- EntityFormWidgetTest
- Class for Entity browser entity form Javascript functional tests.
Namespace
Drupal\Tests\entity_browser_entity_form\FunctionalJavascriptCode
protected function setUp() {
parent::setUp();
$this
->drupalCreateContentType([
'type' => 'foo',
'name' => 'Foo',
]);
FieldStorageConfig::create([
'field_name' => 'field_reference',
'type' => 'entity_reference',
'entity_type' => 'node',
'cardinality' => FieldStorageDefinitionInterface::CARDINALITY_UNLIMITED,
'settings' => [
'target_type' => 'node',
],
])
->save();
FieldConfig::create([
'field_name' => 'field_reference',
'entity_type' => 'node',
'bundle' => 'foo',
'label' => 'Reference',
'settings' => [],
])
->save();
/** @var \Drupal\Core\Entity\Display\EntityFormDisplayInterface $form_display */
$form_display = $this->container
->get('entity_type.manager')
->getStorage('entity_form_display')
->load('node.foo.default');
$form_display
->setComponent('field_reference', [
'type' => 'entity_browser_entity_reference',
'settings' => [
'entity_browser' => 'entity_browser_test_entity_form',
'field_widget_display' => 'label',
'open' => TRUE,
],
])
->save();
$account = $this
->drupalCreateUser([
'access entity_browser_test_entity_form entity browser pages',
'create foo content',
'create article content',
'access content',
]);
$this
->drupalLogin($account);
}