function CKEditor5UpdatePluginSettingsSortTest::testUpdatePluginSettingsSortEntitySave

Same name and namespace in other branches
  1. 10 core/modules/ckeditor5/tests/src/Functional/Update/CKEditor5UpdatePluginSettingsSortTest.php \Drupal\Tests\ckeditor5\Functional\Update\CKEditor5UpdatePluginSettingsSortTest::testUpdatePluginSettingsSortEntitySave()

Ensure settings for CKEditor 5 plugins are sorted by plugin key.

File

core/modules/ckeditor5/tests/src/Functional/Update/CKEditor5UpdatePluginSettingsSortTest.php, line 54

Class

CKEditor5UpdatePluginSettingsSortTest
@covers ckeditor5_post_update_plugins_settings_export_order @group Update @group ckeditor5

Namespace

Drupal\Tests\ckeditor5\Functional\Update

Code

public function testUpdatePluginSettingsSortEntitySave() : void {
    $editor = Editor::load('basic_html');
    $settings = $editor->getSettings();
    $plugin_settings_before = array_keys($settings['plugins']);
    $editor->save();
    $editor = Editor::load('basic_html');
    $settings = $editor->getSettings();
    $plugin_settings_after = array_keys($settings['plugins']);
    // Different sort before and after, but the same values.
    $this->assertNotSame($plugin_settings_before, $plugin_settings_after);
    sort($plugin_settings_before);
    $this->assertSame($plugin_settings_before, $plugin_settings_after);
}

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