You are here

public function ImporterTest::testImport in GatherContent 8.4

Test the import function.

File

tests/src/Kernel/ImporterTest.php, line 27

Class

ImporterTest
Tests for the importer class.

Namespace

Drupal\Tests\gathercontent\Kernel

Code

public function testImport() {
  $importer = static::getImporter();
  $operation = Operation::create([
    'type' => 'import',
  ]);
  $importOptions = new ImportOptions(NodeUpdateMethod::ALWAYS_CREATE, FALSE, 2, 'main:', $operation
    ->uuid());
  $mapping = MockData::getMapping();
  $item = MockData::createItem($mapping, [
    FALSE,
    FALSE,
    FALSE,
  ], [
    FALSE,
    FALSE,
    FALSE,
  ]);
  $importer
    ->import($item, $importOptions);
  static::assertStatusChooseCalled($importOptions
    ->getNewStatus());
  static::assertMockImportEventsCalled();
  static::assertMenuLinkCreated('main', $item->name);
}