protected function FootnotesFilterPluginTest::createTextFormat in Footnotes 8.2
Create a new text format.
Parameters
bool $additional_settings: Indicates if filter settings should be enabled.
1 call to FootnotesFilterPluginTest::createTextFormat()
- FootnotesFilterPluginTest::setUp in tests/
src/ Functional/ FootnotesFilterPluginTest.php
File
- tests/
src/ Functional/ FootnotesFilterPluginTest.php, line 138
Class
- FootnotesFilterPluginTest
- Contains Footnotes Filter plugin functionality tests.
Namespace
Drupal\Tests\footnotes\FunctionalCode
protected function createTextFormat($additional_settings = FALSE) {
$button_groups = json_encode([
[
[
'name' => 'Tools',
'items' => [
'Source',
'footnotes',
],
],
],
]);
$edit = [
'format' => $this->formatName,
'name' => $this->formatName,
'roles[' . AccountInterface::AUTHENTICATED_ROLE . ']' => TRUE,
'editor[editor]' => 'ckeditor',
'filters[filter_footnotes][status]' => TRUE,
];
$this
->drupalGet("admin/config/content/formats/add");
// Keep the "CKEditor" editor selected and click the "Configure" button.
$this
->drupalPostForm(NULL, $edit, 'editor_configure');
$edit['editor[settings][toolbar][button_groups]'] = $button_groups;
$edit['filters[filter_footnotes][settings][footnotes_collapse]'] = $button_groups;
if ($additional_settings) {
$edit['filters[filter_footnotes][settings][footnotes_collapse]'] = 1;
$edit['filters[filter_footnotes][settings][footnotes_html]'] = 1;
}
$this
->drupalPostForm(NULL, $edit, $this
->t('Save configuration'));
$this
->assertText($this
->t('Added text format @format.', [
'@format' => $this->formatName,
]));
}