function EntityMethodConfigActionsTest::testSetMultipleThirdPartySettings

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

File

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

Class

EntityMethodConfigActionsTest
@group Recipe

Namespace

Drupal\KernelTests\Core\Recipe

Code

public function testSetMultipleThirdPartySettings() : void {
    $this->configActionManager
        ->applyAction('entity_method:core.entity_view_display:setThirdPartySettings', 'core.entity_view_display.entity_test_with_bundle.test.default', [
        [
            'module' => 'entity_test',
            'key' => 'noun',
            'value' => 'Spaceship',
        ],
        [
            'module' => 'entity_test',
            'key' => 'verb',
            'value' => 'Explode',
        ],
    ]);
    
    /** @var \Drupal\Core\Config\Entity\ThirdPartySettingsInterface $display */
    $display = $this->container
        ->get(EntityDisplayRepositoryInterface::class)
        ->getViewDisplay('entity_test_with_bundle', 'test');
    $this->assertSame('Spaceship', $display->getThirdPartySetting('entity_test', 'noun'));
    $this->assertSame('Explode', $display->getThirdPartySetting('entity_test', 'verb'));
}

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