function EditorValidationTest::testInvalidDependencies
Tests that validation fails if config dependencies are invalid.
File
- 
              core/modules/ editor/ tests/ src/ Kernel/ EditorValidationTest.php, line 81 
Class
- EditorValidationTest
- Tests validation of editor entities.
Namespace
Drupal\Tests\editor\KernelCode
public function testInvalidDependencies() : void {
  // Remove the config dependencies from the editor entity.
  $dependencies = $this->entity
    ->getDependencies();
  $dependencies['config'] = [];
  $this->entity
    ->set('dependencies', $dependencies);
  $this->assertValidationErrors([
    '' => 'This text editor requires a text format.',
  ]);
  // Things look sort-of like `filter.format.*` should fail validation
  // because they don't exist.
  $dependencies['config'] = [
    'filter.format',
    'filter.format.',
  ];
  $this->entity
    ->set('dependencies', $dependencies);
  $this->assertValidationErrors([
    '' => 'This text editor requires a text format.',
    'dependencies.config.0' => "The 'filter.format' config does not exist.",
    'dependencies.config.1' => "The 'filter.format.' config does not exist.",
  ]);
}Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
