You are here

protected function NoNbspWebTestCase::createTextFormatWeb in No Non-breaking Space Filter 7

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 NoNbspWebTestCase::createTextFormatWeb()
FieldFormatterTest::testFieldFormatter in ./no_nbsp.test
Field formatter.
NoNbspWebTestCase::createFormatAndNode in ./no_nbsp.test
Create a new text format and a new node.

File

./no_nbsp.test, line 52
Tests for the no_nbsp.module.

Class

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

Code

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