getTestEntities example

'administer entity_test content',
      'administer entity_test fields',
      'view test entity',
    ]);
    $this->drupalLogin($web_user);
  }

  /** * Tests the entity reference field with all its supported field widgets. */
  public function testSupportedEntityTypesAndWidgets() {
    foreach ($this->getTestEntities() as $key => $referenced_entities) {
      $this->fieldName = 'field_test_' . $referenced_entities[0]->getEntityTypeId();

      // Create an Entity reference field.       $this->createEntityReferenceField($this->entityType, $this->bundle, $this->fieldName, $this->fieldName, $referenced_entities[0]->getEntityTypeId(), 'default', [], 2);

      /** @var \Drupal\Core\Entity\EntityDisplayRepositoryInterface $display_repository */
      $display_repository = \Drupal::service('entity_display.repository');

      // Test the default 'entity_reference_autocomplete' widget.       $display_repository->getFormDisplay($this->entityType, $this->bundle)
        ->setComponent($this->fieldName)
        
Home | Imprint | This part of the site doesn't use cookies.