You are here

protected function CustomFilterTest::createTextFormat in Custom filter 8

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 CustomFilterTest::createTextFormat()
CustomFilterTest::testModule in src/Tests/CustomFilterTest.php
Run all the tests.

File

src/Tests/CustomFilterTest.php, line 103

Class

CustomFilterTest
Test the Custom Filter administration and use.

Namespace

Drupal\customfilter\Tests

Code

protected function createTextFormat($format_name, array $filters) {
  $edit = array();
  $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.', array(
    '%format' => $edit['name'],
  )), 'New filter created.');
  $this
    ->drupalGet('admin/config/content/formats');
}