You are here

protected function ComplexWidgetTest::createNodeForEveryBundle in Inline Entity Form 8

Creates a node for every node bundle.

Return value

array Array of node titles keyed by ids.

2 calls to ComplexWidgetTest::createNodeForEveryBundle()
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 756

Class

ComplexWidgetTest
IEF complex field widget tests.

Namespace

Drupal\Tests\inline_entity_form\FunctionalJavascript

Code

protected function createNodeForEveryBundle() {
  $retval = [];
  $bundles = $this->container
    ->get('entity_type.bundle.info')
    ->getBundleInfo('node');
  foreach ($bundles as $id => $value) {
    $this
      ->drupalCreateNode([
      'type' => $id,
      'title' => $value['label'],
    ]);
    $node = $this
      ->drupalGetNodeByTitle($value['label']);
    $this
      ->assertNotEmpty($node, 'Created node "' . $node
      ->label() . '"');
    $retval[$node
      ->id()] = $value['label'];
  }
  return $retval;
}