function WildcardConfigActionsTest::testCreateForEachWithLabel
Tests using the `%label` placeholder with the createForEach action.
File
-
core/
tests/ Drupal/ KernelTests/ Core/ Recipe/ WildcardConfigActionsTest.php, line 193
Class
- WildcardConfigActionsTest
- Tests config actions targeting multiple entities using wildcards.
Namespace
Drupal\KernelTests\Core\RecipeCode
public function testCreateForEachWithLabel() : void {
$this->enableModules([
'image',
]);
// We should be able to use the `%label` placeholder.
$this->container
->get('plugin.manager.config_action')
->applyAction('createForEach', 'node.type.*', [
'image.style.node_%bundle_big' => [
'label' => 'Big image for %label content',
],
]);
$this->assertSame('Big image for Type A content', ImageStyle::load('node_one_big')?->label());
$this->assertSame('Big image for Type B content', ImageStyle::load('node_two_big')?->label());
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.