function TextareaWithSummaryTest::setUp
Same name in this branch
- main core/modules/text/tests/src/Functional/TextareaWithSummaryTest.php \Drupal\Tests\text\Functional\TextareaWithSummaryTest::setUp()
Same name and namespace in other branches
- 11.x core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php \Drupal\Tests\text\FunctionalJavascript\TextareaWithSummaryTest::setUp()
- 10 core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php \Drupal\Tests\text\FunctionalJavascript\TextareaWithSummaryTest::setUp()
- 9 core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php \Drupal\Tests\text\FunctionalJavascript\TextareaWithSummaryTest::setUp()
- 8.9.x core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php \Drupal\Tests\text\FunctionalJavascript\TextareaWithSummaryTest::setUp()
- 11.x core/modules/text/tests/src/Functional/TextareaWithSummaryTest.php \Drupal\Tests\text\Functional\TextareaWithSummaryTest::setUp()
Overrides BrowserTestBase::setUp
File
-
core/
modules/ text/ tests/ src/ FunctionalJavascript/ TextareaWithSummaryTest.php, line 33
Class
- TextareaWithSummaryTest
- Tests the JavaScript functionality of the text_textarea_with_summary widget.
Namespace
Drupal\Tests\text\FunctionalJavascriptCode
protected function setUp() : void {
parent::setUp();
$this->drupalCreateContentType([
'type' => 'page',
], FALSE);
FieldStorageConfig::create([
'field_name' => 'body_test',
'type' => 'text_with_summary',
'entity_type' => 'node',
'cardinality' => 1,
])->save();
$fieldStorage = FieldStorageConfig::loadByName('node', 'body_test');
FieldConfig::create([
'field_storage' => $fieldStorage,
'bundle' => 'page',
'label' => 'Body Test',
'settings' => [
'display_summary' => TRUE,
'allowed_formats' => [],
],
])->save();
$display_repository = \Drupal::service('entity_display.repository');
// Assign widget settings for the default form mode.
$display_repository->getFormDisplay('node', 'page')
->setComponent('body_test', [
'type' => 'text_textarea_with_summary',
])
->save();
// Assign display settings for the 'default' view mode.
$display_repository->getViewDisplay('node', 'page')
->setComponent('body_test', [
'label' => 'hidden',
'type' => 'text_default',
])
->save();
$account = $this->drupalCreateUser([
'create page content',
'edit own page content',
]);
$this->drupalLogin($account);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.