You are here

protected function BulkDocsNormalizerTest::createTestEntities in Replication 8.2

1 call to BulkDocsNormalizerTest::createTestEntities()
BulkDocsNormalizerTest::setUp in tests/src/Unit/Normalizer/BulkDocsNormalizerTest.php

File

tests/src/Unit/Normalizer/BulkDocsNormalizerTest.php, line 105

Class

BulkDocsNormalizerTest
Tests the content serialization format.

Namespace

Drupal\Tests\replication\Unit\Normalizer

Code

protected function createTestEntities($entity_type, $number = 3) {
  $entities = [];
  $entity_manager = \Drupal::entityManager();
  while ($number >= 1) {
    $values = [
      'name' => $this
        ->randomMachineName(),
      'user_id' => 0,
      'field_test_text' => [
        'value' => $this
          ->randomMachineName(),
        'format' => 'full_html',
      ],
    ];
    $this->testValues[] = $values;
    $entity = $entity_manager
      ->getStorage($entity_type)
      ->create($values);
    $entity
      ->save();
    $entities[] = $entity;
    $number--;
  }
  return $entities;
}