protected function MapWidgetTest::setUp in Map Widget 8
Overrides BrowserTestBase::setUp
File
- tests/
src/ Functional/ MapWidgetTest.php, line 50
Class
- MapWidgetTest
- Test the actual widget for map_widget.
Namespace
Drupal\Tests\map_widget\FunctionalCode
protected function setUp() {
parent::setUp();
$this->state = $this->container
->get('state');
// Create a field.
$definition['map_test_field'] = BaseFieldDefinition::create('map')
->setLabel('Map Widget Test')
->setDisplayOptions('view', [
'region' => 'hidden',
])
->setDisplayOptions('form', [
'type' => 'map_assoc_widget',
'region' => 'content',
'settings' => [
'size' => '40',
'key_placeholder' => 'Key placeholder for map_assoc_widget',
'value_placeholder' => 'Value placeholder for map_assoc_widget',
],
'weight' => 90,
])
->setTranslatable(FALSE)
->setDescription('Map Widget description')
->setDisplayConfigurable('form', TRUE)
->setDisplayConfigurable('view', FALSE);
$this->state
->set('entity_test.additional_base_field_definitions', $definition);
$this
->applyEntityUpdates('entity_test');
$this->user = $this
->drupalCreateUser([
'administer site configuration',
'administer entity_test content',
]);
$this
->drupalLogin($this->user);
}