You are here

protected function GeshiFilterAdministrationTest::createTextFormat in GeSHi Filter for syntax highlighting 8

Same name and namespace in other branches
  1. 8.2 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 149

Class

GeshiFilterAdministrationTest
Test for administrative interface of GeshiFilter.

Namespace

Drupal\Tests\geshifilter\Functional

Code

protected function createTextFormat($format_name, array $filters) {
  $edit = [];
  $edit['format'] = $format_name;
  $edit['name'] = $this
    ->randomMachineName();
  $edit['roles[' . DRUPAL_AUTHENTICATED_RID . ']'] = 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');
}