You are here

DrushBatchImportTest.php in Migrate Tools 8.5

Same filename and directory in other branches
  1. 8.4 tests/src/Functional/DrushBatchImportTest.php

File

tests/src/Functional/DrushBatchImportTest.php
View source
<?php

namespace Drupal\Tests\migrate_tools\Functional;

use Drupal\Tests\BrowserTestBase;
use Drush\TestTraits\DrushTestTrait;

/**
 * Test that batch import runs correctly in drush command.
 *
 * @group migrate_tools
 */
class DrushBatchImportTest extends BrowserTestBase {
  use DrushTestTrait;

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'migrate_tools_test',
    'migrate_tools',
    'migrate_plus',
    'taxonomy',
    'text',
    'system',
    'user',
  ];

  /**
   * Tests that a batch import run from a custom drush command succeeds.
   */
  public function testBatchImportInDrushComand() : void {
    $this
      ->drush('migrate:batch-import-fruit');
    $migration = \Drupal::service('plugin.manager.migration')
      ->createInstance('fruit_terms');
    $id_map = $migration
      ->getIdMap();
    $this
      ->assertSame(3, $id_map
      ->importedCount());
  }

}

Classes

Namesort descending Description
DrushBatchImportTest Test that batch import runs correctly in drush command.