You are here

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

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/GeshiFilterCssTest.php \Drupal\Tests\geshifilter\Functional\GeshiFilterCssTest::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.

1 call to GeshiFilterCssTest::createTextFormat()
GeshiFilterCssTest::setUp in tests/src/Functional/GeshiFilterCssTest.php
Set up the tests and create the users.

File

tests/src/Functional/GeshiFilterCssTest.php, line 194

Class

GeshiFilterCssTest
Test for css generation and use in 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');
}