function BlockValidationTest::testRequiredPropertyValuesMissing

A property that is required must have a value (i.e. not NULL).

@todo Remove this optional parameter in https://www.drupal.org/project/drupal/issues/2820364#comment-15333069

Parameters

string[]|null $additional_expected_validation_errors_when_missing: Some required config entity properties have additional validation constraints that cause additional messages to appear. Keys must be config entity properties, values must be arrays as expected by ::assertValidationErrors().

Return value

void No return value.

Overrides ConfigEntityValidationTestBase::testRequiredPropertyValuesMissing

File

core/modules/block/tests/src/Kernel/BlockValidationTest.php, line 136

Class

BlockValidationTest
Tests validation of block entities.

Namespace

Drupal\Tests\block\Kernel

Code

public function testRequiredPropertyValuesMissing(?array $additional_expected_validation_errors_when_missing = NULL) : void {
  parent::testRequiredPropertyValuesMissing([
    'region' => [
      'region' => [
        'This is not a valid region of the <em class="placeholder">stark</em> theme.',
        'This value should not be null.',
      ],
    ],
    'theme' => [
      'region' => 'This block does not say which theme it appears in.',
    ],
  ]);
}

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