You are here

protected function ComplexWidgetTest::createReferenceContent in Inline Entity Form 8

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.

5 calls to ComplexWidgetTest::createReferenceContent()
ComplexWidgetTest::testDuplicatingEntities in tests/src/FunctionalJavascript/ComplexWidgetTest.php
Tests if duplicating entities works.
ComplexWidgetTest::testEditedInlineEntityValidation in tests/src/FunctionalJavascript/ComplexWidgetTest.php
Tests if a referenced content can be edited.
ComplexWidgetTest::testEntityEditingAndRemoving in tests/src/FunctionalJavascript/ComplexWidgetTest.php
Tests if editing and removing entities work.
ComplexWidgetTest::testReferenceExistingValidation in tests/src/FunctionalJavascript/ComplexWidgetTest.php
Test if invalid values get correct validation messages.
ComplexWidgetTest::testReferencingExistingEntities in tests/src/FunctionalJavascript/ComplexWidgetTest.php
Tests if referencing existing entities work.

File

tests/src/FunctionalJavascript/ComplexWidgetTest.php, line 718

Class

ComplexWidgetTest
IEF complex field widget tests.

Namespace

Drupal\Tests\inline_entity_form\FunctionalJavascript

Code

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