You are here

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

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

File

geshifield/tests/src/Functional/GeshiFieldTest.php, line 96

Class

GeshiFieldTest
Tests for GeshiField in node content.

Namespace

Drupal\Tests\geshifield\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');
}