function WildcardConfigActionsTest::testCreateForEachIfNotExists

Tests that the createForEachIfNotExists action ignores existing config.

File

core/tests/Drupal/KernelTests/Core/Recipe/WildcardConfigActionsTest.php, line 210

Class

WildcardConfigActionsTest
Tests config actions targeting multiple entities using wildcards.

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testCreateForEachIfNotExists() : void {
    $this->enableModules([
        'language',
    ]);
    ContentLanguageSettings::create([
        'target_entity_type_id' => 'node',
        'target_bundle' => 'one',
    ])->save();
    $this->container
        ->get('plugin.manager.config_action')
        ->applyAction('createForEachIfNotExists', 'node.type.*', [
        'language.content_settings.node.%bundle' => [
            'target_entity_type_id' => 'node',
            'target_bundle' => '%bundle',
        ],
    ]);
    $this->assertIsObject(ContentLanguageSettings::loadByEntityTypeBundle('node', 'two'));
}

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