protected function DisplayModeUpdateTest::setUp in Drupal 8
Same name and namespace in other branches
- 9 core/modules/field/tests/src/Kernel/DisplayModeUpdateTest.php \Drupal\Tests\field\Kernel\DisplayModeUpdateTest::setUp()
Set the default field storage backend for fields created during tests.
Overrides FieldKernelTestBase::setUp
File
- core/
modules/ field/ tests/ src/ Kernel/ DisplayModeUpdateTest.php, line 50
Class
- DisplayModeUpdateTest
- Ensure display modes are updated when fields are created.
Namespace
Drupal\Tests\field\KernelCode
protected function setUp() {
parent::setUp();
// Create 'default' view-display.
$default_view_display = EntityViewDisplay::create([
'targetEntityType' => 'entity_test',
'bundle' => 'entity_test',
'mode' => 'default',
'status' => TRUE,
]);
$default_view_display
->save();
$this->defaultViewDisplayName = $default_view_display
->getConfigDependencyName();
// Create 'default' form-display.
$default_form_display = EntityFormDisplay::create([
'targetEntityType' => 'entity_test',
'bundle' => 'entity_test',
'mode' => 'default',
'status' => TRUE,
]);
$default_form_display
->save();
$this->defaultFormDisplayName = $default_form_display
->getConfigDependencyName();
// Create a view-mode 'foobar', create view-display that uses it.
EntityViewMode::create([
'id' => 'entity_test.foobar',
'targetEntityType' => 'entity_test',
'status' => TRUE,
'enabled' => TRUE,
])
->save();
$foobar_view_display = EntityViewDisplay::create([
'targetEntityType' => 'entity_test',
'bundle' => 'entity_test',
'mode' => 'foobar',
'status' => TRUE,
]);
$foobar_view_display
->save();
$this->foobarViewDisplayName = $foobar_view_display
->getConfigDependencyName();
// Create a new form-mode 'foobar', create form-display that uses it.
EntityFormMode::create([
'id' => 'entity_test.foobar',
'targetEntityType' => 'entity_test',
'status' => TRUE,
'enabled' => TRUE,
])
->save();
$foobar_form_display = EntityFormDisplay::create([
'targetEntityType' => 'entity_test',
'bundle' => 'entity_test',
'mode' => 'foobar',
'status' => TRUE,
]);
$foobar_form_display
->save();
$this->foobarFormDisplayName = $foobar_form_display
->getConfigDependencyName();
}