You are here

protected function EntityReferenceIntegrationTest::getTestEntities in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/modules/field/src/Tests/EntityReference/EntityReferenceIntegrationTest.php \Drupal\field\Tests\EntityReference\EntityReferenceIntegrationTest::getTestEntities()

Creates two content and two config test entities.

Return value

array An array of entity objects.

1 call to EntityReferenceIntegrationTest::getTestEntities()
EntityReferenceIntegrationTest::testSupportedEntityTypesAndWidgets in core/modules/field/src/Tests/EntityReference/EntityReferenceIntegrationTest.php
Tests the entity reference field with all its supported field widgets.

File

core/modules/field/src/Tests/EntityReference/EntityReferenceIntegrationTest.php, line 199
Contains \Drupal\field\Tests\EntityReference\EntityReferenceIntegrationTest.

Class

EntityReferenceIntegrationTest
Tests various Entity reference UI components.

Namespace

Drupal\field\Tests\EntityReference

Code

protected function getTestEntities() {
  $config_entity_1 = entity_create('config_test', array(
    'id' => $this
      ->randomMachineName(),
    'label' => $this
      ->randomMachineName(),
  ));
  $config_entity_1
    ->save();
  $config_entity_2 = entity_create('config_test', array(
    'id' => $this
      ->randomMachineName(),
    'label' => $this
      ->randomMachineName(),
  ));
  $config_entity_2
    ->save();
  $content_entity_1 = entity_create('entity_test', array(
    'name' => $this
      ->randomMachineName(),
  ));
  $content_entity_1
    ->save();
  $content_entity_2 = entity_create('entity_test', array(
    'name' => $this
      ->randomMachineName(),
  ));
  $content_entity_2
    ->save();
  return array(
    'config' => array(
      $config_entity_1,
      $config_entity_2,
    ),
    'content' => array(
      $content_entity_1,
      $content_entity_2,
    ),
  );
}