public function ConfigImportUITest::testImportErrorLog in Drupal 10
Same name and namespace in other branches
- 8 core/modules/config/tests/src/Functional/ConfigImportUITest.php \Drupal\Tests\config\Functional\ConfigImportUITest::testImportErrorLog()
- 9 core/modules/config/tests/src/Functional/ConfigImportUITest.php \Drupal\Tests\config\Functional\ConfigImportUITest::testImportErrorLog()
Tests an import that results in an error.
File
- core/
modules/ config/ tests/ src/ Functional/ ConfigImportUITest.php, line 406
Class
- ConfigImportUITest
- Tests the user interface for importing configuration.
Namespace
Drupal\Tests\config\FunctionalCode
public function testImportErrorLog() {
$name_primary = 'config_test.dynamic.primary';
$name_secondary = 'config_test.dynamic.secondary';
$sync = $this->container
->get('config.storage.sync');
$uuid = $this->container
->get('uuid');
$values_primary = [
'uuid' => $uuid
->generate(),
'langcode' => 'en',
'status' => TRUE,
'dependencies' => [],
'id' => 'primary',
'label' => 'Primary',
'weight' => 0,
'style' => NULL,
'size' => NULL,
'size_value' => NULL,
'protected_property' => NULL,
];
$sync
->write($name_primary, $values_primary);
$values_secondary = [
'uuid' => $uuid
->generate(),
'langcode' => 'en',
'status' => TRUE,
// Add a dependency on primary, to ensure that is synced first.
'dependencies' => [
'config' => [
$name_primary,
],
],
'id' => 'secondary',
'label' => 'Secondary Sync',
'weight' => 0,
'style' => NULL,
'size' => NULL,
'size_value' => NULL,
'protected_property' => NULL,
];
$sync
->write($name_secondary, $values_secondary);
// Verify that there are configuration differences to import.
$this
->drupalGet('admin/config/development/configuration');
$this
->assertSession()
->pageTextNotContains('The staged configuration is identical to the active configuration.');
// Attempt to import configuration and verify that an error message appears.
$this
->submitForm([], 'Import all');
$this
->assertSession()
->pageTextContains('Deleted and replaced configuration entity "' . $name_secondary . '"');
$this
->assertSession()
->pageTextContains('The configuration was imported with errors.');
$this
->assertSession()
->pageTextNotContains('The configuration was imported successfully.');
$this
->assertSession()
->pageTextContains('The staged configuration is identical to the active configuration.');
}