You are here

protected function NoNbspWebTestBase::createTextFormatWeb in No Non-breaking Space Filter 8

Create a new text format.

Create a new text format with an enabled no non-breaking space filter using the web functions provided by simpletest.

Parameters

string $name: The machine name of the new text format.

bool $status: If the filter is enabled or not.

2 calls to NoNbspWebTestBase::createTextFormatWeb()
FieldFormatterTest::testFieldFormatter in src/Tests/FieldFormatterTest.php
Field formatter.
NoNbspWebTestBase::createFormatAndNode in src/Tests/NoNbspWebTestBase.php
Create a new text format and a new node.

File

src/Tests/NoNbspWebTestBase.php, line 56
Tests for the no_nbsp.module.

Class

NoNbspWebTestBase
Base class for the no non-breaking space filter tests.

Namespace

Drupal\no_nbsp\Tests

Code

protected function createTextFormatWeb($name, $status) {
  $edit = [
    'format' => $name,
    'name' => $name,
    'roles[anonymous]' => 1,
    'roles[authenticated]' => 1,
  ];
  if ($status) {
    $edit['filters[filter_no_nbsp][status]'] = $status;
  }
  $this
    ->drupalPostForm('admin/config/content/formats/add', $edit, t('Save configuration'));
  filter_formats_reset();
  $formats = filter_formats();
  return $formats[$name];
}