You are here

public function ImportTrackingTest::testImportQueueOperations in Acquia Content Hub 8.2

Tests adding items to queue.

File

tests/src/Kernel/ImportTrackingTest.php, line 123

Class

ImportTrackingTest
Class ImportTest.

Namespace

Drupal\Tests\acquia_contenthub\Kernel

Code

public function testImportQueueOperations() {
  $this
    ->assertEquals(0, $this->importQueue
    ->getQueueCount(), 'By default import queue should be empty.');

  // Simulate adding of 2 content entities.
  $payload = [
    'status' => 'successful',
    'crud' => 'update',
    'assets' => [
      [
        'uuid' => '00000000-0001-460b-ac74-b6bed08b4441',
        'type' => 'drupal8_content_entity',
      ],
      [
        'uuid' => '00000000-0002-4be4-8bf0-c86d895721e9',
        'type' => 'drupal8_config_entity',
      ],
    ],
    'initiator' => $this->initiatorID,
  ];
  $this
    ->invokeImportUpdateAssets($payload);
  $this
    ->assertEquals(1, $this->importQueue
    ->getQueueCount());

  // Add one more item.
  $payload = [
    'status' => 'successful',
    'crud' => 'update',
    'assets' => [
      [
        'uuid' => '00000000-0003-460b-ac74-b6bed08b4441',
        'type' => 'drupal8_content_entity',
      ],
    ],
    'initiator' => $this->initiatorID,
  ];
  $this
    ->invokeImportUpdateAssets($payload);
  $this
    ->assertEquals(2, $this->importQueue
    ->getQueueCount());
}