function MappingTest::testInvalidRequiredKeyFlag

Same name in other branches
  1. 11.x core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php \Drupal\KernelTests\Config\Schema\MappingTest::testInvalidRequiredKeyFlag()

@testWith [true] [1] ["true"] [0] ["false"]

File

core/tests/Drupal/KernelTests/Config/Schema/MappingTest.php, line 555

Class

MappingTest
@coversDefaultClass \Drupal\Core\Config\Schema\Mapping @group Config

Namespace

Drupal\KernelTests\Config\Schema

Code

public function testInvalidRequiredKeyFlag(mixed $required_key_flag_value) : void {
    $this->expectException(\LogicException::class);
    $this->expectExceptionMessage('The `requiredKey` flag must either be omitted or have `false` as the value.');
    new Mapping(new MapDataDefinition([
        'type' => 'mapping',
        'mapping' => [
            'something' => [
                'requiredKey' => $required_key_flag_value,
            ],
        ],
    ]));
}

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