function ConfigEntityImportTest::doThirdPartySettingsUpdate

Same name in other branches
  1. 8.9.x core/modules/system/tests/src/Kernel/Entity/ConfigEntityImportTest.php \Drupal\Tests\system\Kernel\Entity\ConfigEntityImportTest::doThirdPartySettingsUpdate()
  2. 10 core/modules/system/tests/src/Kernel/Entity/ConfigEntityImportTest.php \Drupal\Tests\system\Kernel\Entity\ConfigEntityImportTest::doThirdPartySettingsUpdate()
  3. 11.x core/modules/system/tests/src/Kernel/Entity/ConfigEntityImportTest.php \Drupal\Tests\system\Kernel\Entity\ConfigEntityImportTest::doThirdPartySettingsUpdate()

Tests updating of third party settings.

1 call to ConfigEntityImportTest::doThirdPartySettingsUpdate()
ConfigEntityImportTest::testConfigUpdateImport in core/modules/system/tests/src/Kernel/Entity/ConfigEntityImportTest.php
Runs test methods for each module within a single test run.

File

core/modules/system/tests/src/Kernel/Entity/ConfigEntityImportTest.php, line 189

Class

ConfigEntityImportTest
Tests ConfigEntity importing.

Namespace

Drupal\Tests\system\Kernel\Entity

Code

protected function doThirdPartySettingsUpdate() {
    // Create a test action with a known label.
    $name = 'system.action.third_party_settings_test';
    
    /** @var \Drupal\config_test\Entity\ConfigTest $entity */
    $entity = Action::create([
        'id' => 'third_party_settings_test',
        'plugin' => 'action_message_action',
    ]);
    $entity->save();
    $this->assertSame([], $entity->getThirdPartyProviders());
    // Get a copy of the configuration before the third party setting is added.
    $no_third_part_setting_config = $this->container
        ->get('config.storage')
        ->read($name);
    // Add a third party setting.
    $entity->setThirdPartySetting('config_test', 'integer', 1);
    $entity->save();
    $this->assertSame(1, $entity->getThirdPartySetting('config_test', 'integer'));
    $has_third_part_setting_config = $this->container
        ->get('config.storage')
        ->read($name);
    // Ensure configuration imports can completely remove third party settings.
    $this->assertConfigUpdateImport($name, $has_third_part_setting_config, $no_third_part_setting_config);
}

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