public function DrushCommandsTest::testContinueOnFailure in Migrate Tools 8.5
Same name and namespace in other branches
- 8.4 tests/src/Functional/DrushCommandsTest.php \Drupal\Tests\migrate_tools\Functional\DrushCommandsTest::testContinueOnFailure()
Test that migrations continue after a failure if the option is set.
File
- tests/
src/ Functional/ DrushCommandsTest.php, line 61
Class
- DrushCommandsTest
- Execute drush on fully functional website.
Namespace
Drupal\Tests\migrate_tools\FunctionalCode
public function testContinueOnFailure() : void {
// Option not set, fruit_terms should not run.
$this
->drush('mim', [
'invalid_plugin,fruit_terms',
], [], NULL, NULL, 1);
$this
->assertStringNotContainsString("done with 'fruit_terms'", $this
->getErrorOutput());
// Option set, fruit_terms should run.
$this
->drush('mim', [
'invalid_plugin,fruit_terms',
], [
'continue-on-failure' => NULL,
]);
$this
->assertStringContainsString("done with 'fruit_terms'", $this
->getErrorOutput());
// Option not set, fruit_terms should not run.
$this
->drush('mr', [
'invalid_plugin,fruit_terms',
], [], NULL, NULL, 1);
$this
->assertStringNotContainsString("done with 'fruit_terms'", $this
->getErrorOutput());
// Option set, fruit_terms should run.
$this
->drush('mr', [
'invalid_plugin,fruit_terms',
], [
'continue-on-failure' => NULL,
]);
$this
->assertStringContainsString("done with 'fruit_terms'", $this
->getErrorOutput());
// Option not set, fruit_terms should not display.
$this
->drush('ms', [
'invalid_plugin,fruit_terms',
], [
'format' => 'json',
], NULL, NULL, 1);
// This demonstrates we surface the exception but not as an error.
$this
->assertStringNotContainsString('[error] The "does_not_exist" plugin does not exist', $this
->getErrorOutput());
$this
->assertStringContainsString('The "does_not_exist" plugin does not exist', $this
->getErrorOutput());
$this
->assertStringNotContainsString('fruit_terms Idle 3', $this
->getOutput());
// Option set, fruit_terms should display.
$this
->drush('ms', [
'invalid_plugin,fruit_terms',
], [
'continue-on-failure' => NULL,
]);
$this
->assertStringContainsString('[error] The "does_not_exist" plugin does not exist', $this
->getErrorOutput());
$this
->assertStringContainsString('fruit_terms Idle 3', $this
->getOutput());
}