function ValidatorsTest::testPair

Same name in other branches
  1. 10 core/modules/ckeditor5/tests/src/Kernel/ValidatorsTest.php \Drupal\Tests\ckeditor5\Kernel\ValidatorsTest::testPair()
  2. 11.x core/modules/ckeditor5/tests/src/Kernel/ValidatorsTest.php \Drupal\Tests\ckeditor5\Kernel\ValidatorsTest::testPair()

@covers \Drupal\ckeditor5\Plugin\Editor\CKEditor5::validatePair() @covers \Drupal\ckeditor5\Plugin\Validation\Constraint\FundamentalCompatibilityConstraintValidator @covers \Drupal\ckeditor5\Plugin\Validation\Constraint\ToolbarItemConstraintValidator @covers \Drupal\ckeditor5\Plugin\Validation\Constraint\ToolbarItemDependencyConstraintValidator @covers \Drupal\ckeditor5\Plugin\Validation\Constraint\EnabledConfigurablePluginsConstraintValidator @covers \Drupal\ckeditor5\Plugin\Validation\Constraint\SourceEditingPreventSelfXssConstraintValidator @dataProvider providerPair

Parameters

array $ckeditor5_settings: The paired text editor's CKEditor 5 settings to test.

array $editor_image_upload_settings: The paired text editor's image upload settings to test.

array $filters: The paired text format's filters and filter settings.

array $expected_violations: All expected violations for the pair.

File

core/modules/ckeditor5/tests/src/Kernel/ValidatorsTest.php, line 568

Class

ValidatorsTest
@covers \Drupal\ckeditor5\Plugin\Validation\Constraint\ToolbarItemConstraintValidator @covers \Drupal\ckeditor5\Plugin\Validation\Constraint\ToolbarItemDependencyConstraintValidator @covers…

Namespace

Drupal\Tests\ckeditor5\Kernel

Code

public function testPair(array $ckeditor5_settings, array $editor_image_upload_settings, array $filters, array $expected_violations) {
    $text_editor = Editor::create([
        'format' => 'dummy',
        'editor' => 'ckeditor5',
        'settings' => $ckeditor5_settings,
        'image_upload' => $editor_image_upload_settings,
    ]);
    EntityViewMode::create([
        'id' => 'media.view_mode_1',
        'targetEntityType' => 'media',
        'status' => TRUE,
        'enabled' => TRUE,
        'label' => 'View Mode 1',
    ])->save();
    EntityViewMode::create([
        'id' => 'media.view_mode_2',
        'targetEntityType' => 'media',
        'status' => TRUE,
        'enabled' => TRUE,
        'label' => 'View Mode 2',
    ])->save();
    assert($text_editor instanceof EditorInterface);
    $this->assertConfigSchema($this->typedConfig, $text_editor->getConfigDependencyName(), $text_editor->toArray());
    $text_format = FilterFormat::create([
        'filters' => $filters,
    ]);
    assert($text_format instanceof FilterFormatInterface);
    $this->assertSame($expected_violations, $this->validatePairToViolationsArray($text_editor, $text_format, TRUE));
}

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