You are here

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

Create a new text format and a new node.

Parameters

string $text: Body text of the node.

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

1 call to NoNbspWebTestCase::createFormatAndNode()
NoNbspIntegrationTestCase::testFormatAdmin in ./no_nbsp.test
Tests the format administration functionality.

File

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

Class

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

Code

protected function createFormatAndNode($text, $status) {
  $format = $this
    ->createTextFormatWeb(strtolower($this
    ->randomName()), $status);
  filter_formats_reset();
  $edit = array();
  $edit['title'] = $this
    ->randomName();
  $edit['body[und][0][value]'] = $text;
  $edit['body[und][0][format]'] = $format->name;
  $this
    ->drupalPost('node/add/page', $edit, t('Save'));
  $node = $this
    ->drupalGetNodeByTitle($edit['title']);
  $this
    ->drupalGet('node/' . $node->nid);
  return $node;
}