You are here

public function ConfigImportUITest::testBatchErrors in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/config/tests/src/Functional/ConfigImportUITest.php \Drupal\Tests\config\Functional\ConfigImportUITest::testBatchErrors()
  2. 9 core/modules/config/tests/src/Functional/ConfigImportUITest.php \Drupal\Tests\config\Functional\ConfigImportUITest::testBatchErrors()

Tests that errors set in the batch and on the ConfigImporter are merged.

File

core/modules/config/tests/src/Functional/ConfigImportUITest.php, line 537

Class

ConfigImportUITest
Tests the user interface for importing configuration.

Namespace

Drupal\Tests\config\Functional

Code

public function testBatchErrors() {
  $new_site_name = 'Config import test ' . $this
    ->randomString();
  $this
    ->prepareSiteNameUpdate($new_site_name);
  \Drupal::state()
    ->set('config_import_steps_alter.error', TRUE);
  $this
    ->drupalGet('admin/config/development/configuration');
  $this
    ->submitForm([], 'Import all');
  $this
    ->assertSession()
    ->responseContains('_config_import_test_config_import_steps_alter batch error');
  $this
    ->assertSession()
    ->responseContains('_config_import_test_config_import_steps_alter ConfigImporter error');
  $this
    ->assertSession()
    ->responseContains('The configuration was imported with errors.');
}