function ConfigImporterTest::testInvalidStep

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php \Drupal\KernelTests\Core\Config\ConfigImporterTest::testInvalidStep()
  2. 8.9.x core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php \Drupal\KernelTests\Core\Config\ConfigImporterTest::testInvalidStep()
  3. 10 core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php \Drupal\KernelTests\Core\Config\ConfigImporterTest::testInvalidStep()

Tests that the isConfigSyncing flag is cleanup after an invalid step.

File

core/tests/Drupal/KernelTests/Core/Config/ConfigImporterTest.php, line 881

Class

ConfigImporterTest
Tests importing configuration from files into active configuration.

Namespace

Drupal\KernelTests\Core\Config

Code

public function testInvalidStep() : void {
    $this->assertFalse(\Drupal::isConfigSyncing(), 'Before an import \\Drupal::isConfigSyncing() returns FALSE');
    $context = [];
    $config_importer = $this->configImporter();
    try {
        $config_importer->doSyncStep('a_non_existent_step', $context);
        $this->fail('Expected \\InvalidArgumentException thrown');
    } catch (\InvalidArgumentException) {
        // Expected exception; just continue testing.
    }
    $this->assertFalse(\Drupal::isConfigSyncing(), 'After an invalid step \\Drupal::isConfigSyncing() returns FALSE');
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.