You are here

protected function ExportTest::createUsers in Acquia Content Hub 8.2

Creates sample Drupal user entities.

Parameters

int $items_expected: Expected number of items in the queue.

array $cdf_expectations: The sets of expectation arguments for CDF object validation.

Return value

array List of user ids.

Throws

\Drupal\Core\Entity\EntityStorageException

3 calls to ExportTest::createUsers()
ExportTest::testPublishing in tests/src/Kernel/ExportTest.php
Tests Acquia ContentHub content/configuration export.
ExportTest::testPublishingUserProfile in tests/src/Kernel/ExportTest.php
Tests publishing of node and user profile.
ExportTest::testQueue in tests/src/Kernel/ExportTest.php
Tests Acquia ContentHub export queue.

File

tests/src/Kernel/ExportTest.php, line 714

Class

ExportTest
Tests entity exports.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

protected function createUsers(&$items_expected, array &$cdf_expectations = []) {
  $name1 = $this
    ->randomString();
  $email1 = 'email1@example.com';
  $user1 = User::create([
    'uid' => 1,
    'name' => $name1,
    'mail' => $email1,
  ]);
  $user1
    ->save();
  $this->userUuids[] = $user1
    ->uuid();
  $name2 = $this
    ->randomString();
  $email2 = 'email2@example.com';
  $user2 = User::create([
    'uid' => 2,
    'name' => $name2,
    'mail' => $email2,
  ]);
  $user2
    ->save();
  $this->userUuids[] = $user2
    ->uuid();
  $items_expected = 2;
  $cdf_expectations = [
    [
      $name1,
      $email1,
    ],
    [
      $name2,
      $email2,
    ],
  ];
  return [
    $user1
      ->id(),
    $user2
      ->id(),
  ];
}