You are here

protected function ContentHubSubscriberTestBase::entityValues in Acquia Content Hub 8

Provides an array of suitable property values for an entity type.

Required properties differ from entity type to entity type, so we keep a minimum mapping here.

Parameters

string $entity_type_id: The ID of the type of entity that should be created.

Return value

array An array of values keyed by property name.

1 call to ContentHubSubscriberTestBase::entityValues()
ContentHubFiltersTest::createContentHubFilter in acquia_contenthub_subscriber/tests/src/Functional/ContentHubFiltersTest.php
Create some basic content hub filter array.

File

acquia_contenthub_subscriber/tests/src/Functional/ContentHubSubscriberTestBase.php, line 283

Class

ContentHubSubscriberTestBase
Provides the base class for web tests for Content Hub Subscribers.

Namespace

Drupal\Tests\acquia_contenthub_subscriber\Functional

Code

protected function entityValues($entity_type_id) {
  switch ($entity_type_id) {
    case 'node':
      return [
        'title' => $this
          ->randomString(),
        'type' => 'resttest',
      ];
    case 'node_type':
      return [
        'type' => 'article',
        'name' => $this
          ->randomMachineName(),
      ];
    case 'user':
      return [
        'name' => $this
          ->randomMachineName(),
      ];
    case 'taxonomy_vocabulary':
      return [
        'vid' => 'tags',
        'name' => $this
          ->randomMachineName(),
      ];
    default:
      if ($this
        ->isConfigEntity($entity_type_id)) {
        return $this
          ->configEntityValues($entity_type_id);
      }
      return [];
  }
}