You are here

protected function CustomFilterTest::createTextFormat in Custom filter 2.0.x

Create a new text format.

1 call to CustomFilterTest::createTextFormat()
CustomFilterTest::testModule in tests/src/Functional/CustomFilterTest.php
Run all the tests.

File

tests/src/Functional/CustomFilterTest.php, line 132

Class

CustomFilterTest
Test the Custom Filter administration and use.

Namespace

Drupal\Tests\customfilter\Functional

Code

protected function createTextFormat() {
  $edit = [];
  $edit['format'] = 'customfilter';
  $edit['name'] = $this
    ->randomMachineName();
  $edit['roles[' . RoleInterface::AUTHENTICATED_ID . ']'] = 1;
  $edit['filters[customfilter_test_filter][status]'] = TRUE;
  $this
    ->drupalGet('admin/config/content/formats/add');
  $this
    ->assertSession()
    ->pageTextContains('filter_name');
  $this
    ->submitForm($edit, 'Save configuration');
  $message = new FormattableMarkup('Added text format %filter.', [
    '%filter' => $edit['name'],
  ]);
  $this
    ->assertSession()
    ->responseContains($message);
  $this
    ->drupalGet('admin/config/content/formats');
}