protected function EntityReferenceSynonymsBehaviorWebTestCase::createNode in Synonyms 7
Supportive function.
Create an entity of necessary entity type (in our test it's node).
Parameters
string $label: Label to use for the entity that is about to be created
string $bundle: Bundle to use for the entity that is about to be created
Return value
object Fully loaded entity object of the just created entity
1 call to EntityReferenceSynonymsBehaviorWebTestCase::createNode()
- EntityReferenceSynonymsBehaviorWebTestCase::testEntityReference in synonyms_provider_field/
synonyms_provider_field.test - Test synonyms extraction for 'entityreference' field type.
File
- synonyms_provider_field/
synonyms_provider_field.test, line 862 - Tests for the Synonyms field provider module.
Class
- EntityReferenceSynonymsBehaviorWebTestCase
- Test EntityReferenceSynonymsBehavior class.
Code
protected function createNode($label = NULL, $bundle = 'page') {
if (is_null($label)) {
$label = $this
->randomName();
}
$entity = (object) array(
'type' => $bundle,
'title' => $label,
);
node_save($entity);
return $entity;
}