You are here

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

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/GeshiFilterTest.php \Drupal\Tests\geshifilter\Functional\GeshiFilterTest::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 GeshiFilterTest::createTextFormat()
GeshiFilterTest::setUp in tests/src/Functional/GeshiFilterTest.php
Code run before each and every test method.

File

tests/src/Functional/GeshiFilterTest.php, line 118

Class

GeshiFilterTest
Tests for GeshiFilter in node content.

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');
}