function EditorValidationTest::testImmutableProperties

Same name and namespace in other branches
  1. 11.x core/modules/editor/tests/src/Kernel/EditorValidationTest.php \Drupal\Tests\editor\Kernel\EditorValidationTest::testImmutableProperties()

Tests that immutable properties cannot be changed.

Parameters

mixed[] $valid_values: (optional) The values to set for the immutable properties, keyed by name. This should be used if the immutable properties can only accept certain values, e.g. valid plugin IDs.

Overrides ConfigEntityValidationTestBase::testImmutableProperties

File

core/modules/editor/tests/src/Kernel/EditorValidationTest.php, line 67

Class

EditorValidationTest
Tests validation of editor entities.

Namespace

Drupal\Tests\editor\Kernel

Code

public function testImmutableProperties(array $valid_values = [], ?array $additional_expected_validation_errors_when_missing = NULL) : void {
  // TRICKY: Every Text Editor is associated with a Text Format. It must exist
  // to avoid triggering a validation error.
  // @see \Drupal\editor\EditorInterface::hasAssociatedFilterFormat
  FilterFormat::create([
    'format' => 'another',
    'name' => 'Another',
  ])->save();
  parent::testImmutableProperties([
    'format' => 'another',
  ]);
}

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