public function EntityBackgroundTestBase::createNodeWithParagraph in Entity background 7
Helper method used to create node with paragraphs.
list ($node, $entity) = $this->createNodeWithParagraph(); $this->drupalGet('node/' . $node->nid);
Parameters
string $node_type:
Return value
array
File
- tests/
entity_background.test, line 24 - Test classes for Entity backgrounds.
Class
- EntityBackgroundTestBase
- Class EntityBackgroundTestBase
Code
public function createNodeWithParagraph($node_type = 'eb_test_landing_page') {
$node = $this
->drupalCreateNode(array(
'type' => $node_type,
));
$entity = entity_create('paragraphs_item', array(
'bundle' => 'eb_content_test',
'field_name' => 'field_eb_test_paragraphs',
));
$entity->field_eb_test_body[LANGUAGE_NONE][0]['value'] = $this
->randomString();
$entity
->setHostEntity('node', $node);
$entity
->save();
return array(
$node,
$entity,
);
}