protected function GeshiFilterAdministrationTest::createTextFormat in GeSHi Filter for syntax highlighting 8.2
Same name and namespace in other branches
- 8 tests/src/Functional/GeshiFilterAdministrationTest.php \Drupal\Tests\geshifilter\Functional\GeshiFilterAdministrationTest::createTextFormat()
Create a new text format.
Parameters
string $format_name: The name of new text format.
array $filters: Array with the machine names of filters to enable.
File
- tests/
src/ Functional/ GeshiFilterAdministrationTest.php, line 158
Class
- GeshiFilterAdministrationTest
- Test for administrative interface of GeshiFilter.
Namespace
Drupal\Tests\geshifilter\FunctionalCode
protected function createTextFormat($format_name, array $filters) {
$edit = [];
$edit['format'] = $format_name;
$edit['name'] = $this
->randomMachineName();
$edit['roles[' . AccountInterface::AUTHENTICATED_ROLE . ']'] = 1;
foreach ($filters as $filter) {
$edit['filters[' . $filter . '][status]'] = TRUE;
}
$this
->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
$this
->assertRaw(t('Added text format %format.', [
'%format' => $edit['name'],
]), 'New filter created.');
$this
->drupalGet('admin/config/content/formats');
}