You are here

public function ImportEntityManagerTest::testImportWithQueue in Acquia Content Hub 8

Ensure that if configuration is set the entity will be added to the queue.

@covers ::import @dataProvider provideEntityUuid

File

tests/src/Unit/ImportEntityManagerTest.php, line 1051

Class

ImportEntityManagerTest
PHPUnit test for the ImportEntityManager class.

Namespace

Drupal\Tests\acquia_contenthub\Unit

Code

public function testImportWithQueue($uuid = '') {
  $importEntityManager = $this
    ->getMockBuilder(ImportEntityManager::class)
    ->disableOriginalConstructor()
    ->setMethods([
    'addEntityToImportQueue',
    'importRemoteEntity',
  ])
    ->getMock();
  $this
    ->buildConfigContainer([
    'acquia_contenthub.entity_config' => [
      'import_with_queue' => TRUE,
    ],
  ]);
  $importEntityManager
    ->expects($this
    ->once())
    ->method('addEntityToImportQueue')
    ->with($uuid);
  $importEntityManager
    ->expects($this
    ->never())
    ->method('importRemoteEntity');
  $importEntityManager
    ->import($uuid);
}