You are here

public function DrushTest::testImport in Migrate Tools 8.4

Same name and namespace in other branches
  1. 8.5 tests/src/Kernel/DrushTest.php \Drupal\Tests\migrate_tools\Kernel\DrushTest::testImport()

Tests drush mim.

Throws

\Drupal\Component\Plugin\Exception\PluginException

File

tests/src/Kernel/DrushTest.php, line 135

Class

DrushTest
Tests for the Drush 9 commands.

Namespace

Drupal\Tests\migrate_tools\Kernel

Code

public function testImport() {

  /** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
  $migration = $this->migrationPluginManager
    ->createInstance('fruit_terms');
  $id_map = $migration
    ->getIdMap();
  $this->commands
    ->import('fruit_terms', array_merge($this->importBaseOptions, [
    'idlist' => 'Apple',
  ]));
  $this
    ->assertSame(1, $id_map
    ->importedCount());
  $this->commands
    ->import('fruit_terms', $this->importBaseOptions);
  $this
    ->assertSame(3, $id_map
    ->importedCount());
  $this->commands
    ->import('fruit_terms', array_merge($this->importBaseOptions, [
    'idlist' => 'Apple',
    'update' => TRUE,
  ]));
  $this
    ->assertCount(0, $id_map
    ->getRowsNeedingUpdate(100));
}