You are here

public function DrushTest::testStatus 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::testStatus()

Tests drush ms.

File

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

Class

DrushTest
Tests for the Drush 9 commands.

Namespace

Drupal\Tests\migrate_tools\Kernel

Code

public function testStatus() {
  $this
    ->executeMigration('fruit_terms');

  /** @var \Consolidation\OutputFormatters\StructuredData\RowsOfFields $result */
  $result = $this->commands
    ->status('fruit_terms', [
    'group' => NULL,
    'tag' => NULL,
    'names-only' => FALSE,
  ]);
  $rows = $result
    ->getArrayCopy();
  $this
    ->assertCount(1, $rows);
  $row = reset($rows);
  $this
    ->assertSame('fruit_terms', $row['id']);
  $this
    ->assertSame(3, $row['total']);
  $this
    ->assertSame(3, $row['imported']);
  $this
    ->assertSame('Idle', $row['status']);

  // Migrate status should not display migrate_drupal migrations if no source
  // database is defined.
  \Drupal::service('module_installer')
    ->uninstall([
    'migrate_tools_test',
  ]);
  $this
    ->enableModules([
    'migrate_drupal',
  ]);
  \Drupal::configFactory()
    ->getEditable('migrate_plus.migration.fruit_terms')
    ->delete();
  $rows = $this->commands
    ->status();
  $this
    ->assertEmpty($rows);
}