function EditorBaseTest::testBc

@covers ::buildConfigurationForm @covers ::validateConfigurationForm @covers ::submitConfigurationForm

@expectedDeprecation Drupal\Tests\editor\Unit\BcEditor::settingsForm is deprecated since version 8.3.x. Rename the implementation 'buildConfigurationForm'. See https://www.drupal.org/node/2819753 @expectedDeprecation Drupal\Tests\editor\Unit\BcEditor::settingsFormValidate is deprecated since version 8.3.x. Rename the implementation 'validateConfigurationForm'. See https://www.drupal.org/node/2819753 @expectedDeprecation Drupal\Tests\editor\Unit\BcEditor::settingsFormSubmit is deprecated since version 8.3.x. Rename the implementation 'submitConfigurationForm'. See https://www.drupal.org/node/2819753

File

core/modules/editor/tests/src/Unit/EditorBaseTest.php, line 29

Class

EditorBaseTest
@coversDefaultClass \Drupal\editor\Plugin\EditorBase @group editor

Namespace

Drupal\Tests\editor\Unit

Code

public function testBc() {
    $form_state = new FormState();
    $form_state->set('editor', $this->prophesize(Editor::class)
        ->reveal());
    $editor_plugin = new BcEditor([], 'editor_plugin', []);
    // settingsForm() is deprecated in favor of buildConfigurationForm().
    $this->assertSame($editor_plugin->settingsForm([], clone $form_state, $this->prophesize(Editor::class)
        ->reveal()), $editor_plugin->buildConfigurationForm([], clone $form_state));
    // settingsFormValidate() is deprecated in favor of
    // validateConfigurationForm().
    $form = [];
    $form_state_a = clone $form_state;
    $form_state_b = clone $form_state;
    $editor_plugin->settingsFormValidate($form, $form_state_a, $this->prophesize(Editor::class)
        ->reveal());
    $editor_plugin->validateConfigurationForm($form, $form_state_b);
    $this->assertEquals($form_state_a, $form_state_b);
    // settingsFormSubmit() is deprecated in favor of submitConfigurationForm().
    $form = [];
    $form_state_a = clone $form_state;
    $form_state_b = clone $form_state;
    $editor_plugin->settingsFormSubmit($form, $form_state_a, $this->prophesize(Editor::class)
        ->reveal());
    $editor_plugin->submitConfigurationForm($form, $form_state_b);
    $this->assertEquals($form_state_a, $form_state_b);
}

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