public function DefaultContentTest::testNodeTypeForm in Wysiwyg API template plugin 3.0.x
Same name and namespace in other branches
- 8.2 src/Tests/DefaultContentTest.php \Drupal\wysiwyg_template\Tests\DefaultContentTest::testNodeTypeForm()
Test the node type form.
File
- src/
Tests/ DefaultContentTest.php, line 72
Class
- DefaultContentTest
- Test the ability to specify a template as default content for a node.
Namespace
Drupal\wysiwyg_template\TestsCode
public function testNodeTypeForm() {
$this
->drupalGet($this->nodeType
->toUrl('edit-form'));
$edit = [
'wysiwyg_template_default' => $this->templates[1]
->id(),
];
$this
->drupalPostForm(NULL, $edit, t('Save content type'));
$type = NodeType::load($this->nodeType
->id());
$this
->assertEqual($this->templates[1]
->id(), $type
->getThirdPartySetting('wysiwyg_template', 'default_template'));
// Verify that the default content is set as expected.
$this
->drupalGet('node/add/' . $this->nodeType
->id());
$edit = [
'title[0][value]' => $this
->randomString(),
];
$this
->drupalPostForm(NULL, $edit, t('Save and publish'));
$node = $this
->drupalGetNodeByTitle($edit['title[0][value]']);
$this
->assertEqual($this->templates[1]
->getBody(), $node
->get('body')->value);
}