You are here

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

Tests that a failing rollback throws an exception (i.e. exit code).

File

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

Class

DrushTest
Tests for the Drush 9 commands.

Namespace

Drupal\Tests\migrate_tools\Kernel

Code

public function testFailingRollbackThrowsException() {
  $this
    ->expectException(\Exception::class);
  $this
    ->expectExceptionMessage('source_exception migration failed');

  /** @var \Drupal\migrate\Plugin\MigrationInterface $migration */
  $migration = $this->migrationPluginManager
    ->createInstance('source_exception');
  $migration
    ->setStatus(MigrationInterface::STATUS_IMPORTING);
  $this->commands
    ->rollback('source_exception', $this->importBaseOptions);
}