You are here

public function MigrateHelperTest::testImport in Panopoly 8.2

Tests the import() method.

@covers ::import

File

modules/panopoly/panopoly_core/tests/src/Unit/MigrateHelperTest.php, line 60

Class

MigrateHelperTest
Tests for Panopoly Core's MigrateHelper service.

Namespace

Drupal\Tests\panopoly_core\Unit

Code

public function testImport() {
  $migration1 = $this
    ->prophesize(MigrationInterface::class);
  $migration2 = $this
    ->prophesize(MigrationInterface::class);
  $ids = [
    'migration1',
    'migration2',
  ];
  $this->migrationManager
    ->createInstances($ids)
    ->willReturn([
    $migration1,
    $migration2,
  ]);
  $migrate_helper = $this
    ->getMockBuilder(MigrateHelper::class)
    ->setConstructorArgs([
    $this->migrationManager
      ->reveal(),
  ])
    ->onlyMethods([
    'createExecutable',
  ])
    ->getMock();
  $executable = $this
    ->prophesize(MigrateExecutableInterface::class);
  $executable
    ->import()
    ->shouldBeCalled();
  $migrate_helper
    ->method('createExecutable')
    ->willReturn($executable
    ->reveal());
  $migrate_helper
    ->import($ids);
}