function NodeTypeValidationTest::testThirdPartySettingsMenuUi

Same name and namespace in other branches
  1. 10 core/modules/node/tests/src/Kernel/NodeTypeValidationTest.php \Drupal\Tests\node\Kernel\NodeTypeValidationTest::testThirdPartySettingsMenuUi()

@testWith [true, {"third_party_settings.menu_ui": "'parent' is a required key."}] [false, {}]

File

core/modules/node/tests/src/Kernel/NodeTypeValidationTest.php, line 85

Class

NodeTypeValidationTest
Tests validation of node_type entities.

Namespace

Drupal\Tests\node\Kernel

Code

public function testThirdPartySettingsMenuUi(bool $third_party_settings_menu_ui_fully_validatable, array $expected_validation_errors) : void {
    $this->enableModules([
        'menu_ui',
    ]);
    // Set or unset the `FullyValidatable` constraint on
    // `node.type.*.third_party.menu_ui`.
    $this->enableModules([
        'config_schema_test',
    ]);
    \Drupal::state()->set('config_schema_test_menu_ui_third_party_settings_fully_validatable', $third_party_settings_menu_ui_fully_validatable);
    $this->container
        ->get('kernel')
        ->rebuildContainer();
    $this->entity = $this->createContentType();
    // @see system.menu.main.yml
    $this->installConfig([
        'system',
    ]);
    $this->entity
        ->setThirdPartySetting('menu_ui', 'available_menus', [
        'main',
    ]);
    $this->assertValidationErrors($expected_validation_errors);
}

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