function EntityMethodConfigActionsTest::testSetMultipleThirdPartySettings

Same name in other branches
  1. 11.x core/tests/Drupal/KernelTests/Core/Recipe/EntityMethodConfigActionsTest.php \Drupal\KernelTests\Core\Recipe\EntityMethodConfigActionsTest::testSetMultipleThirdPartySettings()

File

core/tests/Drupal/KernelTests/Core/Recipe/EntityMethodConfigActionsTest.php, line 68

Class

EntityMethodConfigActionsTest
@group Recipe

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testSetMultipleThirdPartySettings() : void {
    $recipe = <<<YAML
name: Third-party setting
config:
  actions:
    core.entity_view_display.node.test.full:
      setThirdPartySettings:
        -
          module: layout_builder
          key: enabled
          value: true
        -
          module: layout_builder
          key: allow_custom
          value: true
YAML;
    $recipe = $this->createRecipe($recipe);
    RecipeRunner::processRecipe($recipe);
    
    /** @var \Drupal\Core\Config\Entity\ThirdPartySettingsInterface $display */
    $display = $this->container
        ->get(EntityDisplayRepositoryInterface::class)
        ->getViewDisplay('node', 'test', 'full');
    $this->assertTrue($display->getThirdPartySetting('layout_builder', 'enabled'));
    $this->assertTrue($display->getThirdPartySetting('layout_builder', 'allow_custom'));
}

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