function ConfigImportCommandTest::testBatchErrors
Tests that errors set in the batch and on the ConfigImporter are merged.
File
-
core/
tests/ Drupal/ FunctionalTests/ Core/ Config/ ConfigImportCommandTest.php, line 367
Class
- ConfigImportCommandTest
- Tests the 'config:import' command.
Namespace
Drupal\FunctionalTests\Core\ConfigCode
public function testBatchErrors() : void {
$new_site_name = 'Config import test ' . $this->randomString();
$this->prepareSiteNameUpdate($new_site_name);
\Drupal::state()->set('config_import_steps_alter.error', TRUE);
$tester = $this->commandTester();
$code = $tester->execute([
'--yes' => TRUE,
]);
self::assertSame(Command::FAILURE, $code);
$display = preg_replace('/\\s+/', ' ', $tester->getDisplay());
// The dr command does not do batches yet.
self::assertStringNotContainsString('[ERROR] _config_import_test_config_import_steps_alter batch error', $display);
self::assertStringContainsString('[ERROR] _config_import_test_config_import_steps_alter ConfigImporter error', $display);
self::assertStringNotContainsString('The configuration was imported successfully.', $display);
self::assertStringContainsString('The configuration was imported with errors.', $display);
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.