You are here

protected function FieldCollectionBasicTestCase::createNodeWithFieldCollection in Field collection 7

Helper for creating a new node with a field collection item.

2 calls to FieldCollectionBasicTestCase::createNodeWithFieldCollection()
FieldCollectionBasicTestCase::testCopyingEntities in ./field_collection.test
Make sure that field_collection-entities are copied when host-entities do.
FieldCollectionBasicTestCase::testCRUD in ./field_collection.test
Tests CRUD.

File

./field_collection.test, line 121
Tests for field_collections.

Class

FieldCollectionBasicTestCase
Test basics.

Code

protected function createNodeWithFieldCollection() {
  $node = $this
    ->drupalCreateNode(array(
    'type' => 'article',
  ));

  // Manually create a field_collection.
  $entity = entity_create('field_collection_item', array(
    'field_name' => $this->field_name,
  ));
  $entity
    ->setHostEntity('node', $node);
  $entity
    ->save();
  return array(
    $node,
    $entity,
  );
}