You are here

protected function MultipleValuesWidgetTest::createReferenceContent in Inline Entity Form 7

Creates ief_reference_type nodes which shall serve as reference nodes.

Parameters

int $numNodes: The number of nodes to create

Return value

array Array of created node ids keyed by labels.

3 calls to MultipleValuesWidgetTest::createReferenceContent()
MultipleValuesWidgetTest::testEditedInlineEntityValidation in tests/multiple_values_widget.test
Tests if a referenced content can be edited while the referenced content is newer than the referencing parent node.
MultipleValuesWidgetTest::testEntityEditingAndRemoving in tests/multiple_values_widget.test
Tests if editing and removing entities work.
MultipleValuesWidgetTest::testReferencingExistingEntities in tests/multiple_values_widget.test
Tests if referencing existing entities work.

File

tests/multiple_values_widget.test, line 530

Class

MultipleValuesWidgetTest
IEF multiple values field widget tests.

Code

protected function createReferenceContent($numNodes = 3) {
  $retval = array();
  for ($i = 1; $i <= $numNodes; $i++) {
    $this
      ->drupalCreateNode(array(
      'type' => 'ief_reference_type',
      'title' => 'Some reference ' . $i,
      'field_first_name' => 'First Name ' . $i,
      'field_last_name' => 'Last Name ' . $i,
    ));
    $node = $this
      ->drupalGetNodeByTitle('Some reference ' . $i);
    $this
      ->assertTrue($node, 'Created ief_reference_type node "' . $node->title . '"');
    $retval[$node->title] = $node->nid;
  }
  return $retval;
}