You are here

protected function NoNbspWebTestCase::createTextFormatProgrammatically 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 programmatically.

Parameters

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

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

File

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

Class

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

Code

protected function createTextFormatProgrammatically($name, $status) {
  $format = array(
    'format' => $name,
    'name' => $name,
    'filters' => array(
      'filter_no_nbsp' => array(
        'status' => $status,
      ),
    ),
  );
  $format = (object) $format;
  filter_format_save($format);
  return $format;
}