protected function NoNbspWebTestBase::createFormatAndNode in No Non-breaking Space Filter 8
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 NoNbspWebTestBase::createFormatAndNode()
- FunctionalTest::testFormatAdmin in src/
Tests/ FunctionalTest.php - Tests the format administration functionality.
File
- src/
Tests/ NoNbspWebTestBase.php, line 80 - Tests for the no_nbsp.module.
Class
- NoNbspWebTestBase
- Base class for the no non-breaking space filter tests.
Namespace
Drupal\no_nbsp\TestsCode
protected function createFormatAndNode($text, $status) {
$format = $this
->createTextFormatWeb(strtolower($this
->randomMachineName()), $status);
filter_formats_reset();
$edit = [];
$edit['title[0][value]'] = $this
->randomMachineName();
$edit['body[0][value]'] = $text;
$edit['body[0][format]'] = $format
->get('name');
$this
->drupalPostForm('node/add/page', $edit, t('Save'));
$node = $this
->drupalGetNodeByTitle($edit['title[0][value]']);
$this
->drupalGet('node/' . $node
->id());
return $node;
}