Commit 4c4a0396 authored by catch's avatar catch
Browse files

Issue #2723587 by marvin_B8, snehi, Beau Townsend, valthebald, John Cook:...

Issue #2723587 by marvin_B8, snehi, Beau Townsend, valthebald, John Cook: Remove entity_load* usage for 'editor' entity type
parent 4bc14c72
Loading
Loading
Loading
Loading
+9 −9
Changes for core/modules/ckeditor/src/Tests/CKEditorAdminTest.php: 9 added lines, 9 removed lines.
Original line number Diff line number Diff line
@@ -55,7 +55,7 @@ function testExistingFormat() {
    $this->drupalGet('admin/config/content/formats/manage/filtered_html');

    // Ensure no Editor config entity exists yet.
    $editor = entity_load('editor', 'filtered_html');
    $editor = Editor::load('filtered_html');
    $this->assertFalse($editor, 'No Editor config entity exists yet.');

    // Verify the "Text Editor" <select> when a text editor is available.
@@ -111,7 +111,7 @@ function testExistingFormat() {

    // Keep the "CKEditor" editor selected and click the "Configure" button.
    $this->drupalPostAjaxForm(NULL, $edit, 'editor_configure');
    $editor = entity_load('editor', 'filtered_html');
    $editor = Editor::load('filtered_html');
    $this->assertFalse($editor, 'No Editor config entity exists yet.');

    // Ensure that drupalSettings is correct.
@@ -142,7 +142,7 @@ function testExistingFormat() {
    // Ensure an Editor object exists now, with the proper settings.
    $expected_settings = $expected_default_settings;
    $expected_settings['plugins']['stylescombo']['styles'] = '';
    $editor = entity_load('editor', 'filtered_html');
    $editor = Editor::load('filtered_html');
    $this->assertTrue($editor instanceof Editor, 'An Editor config entity exists now.');
    $this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');

@@ -153,7 +153,7 @@ function testExistingFormat() {
    );
    $this->drupalPostForm(NULL, $edit, t('Save configuration'));
    $expected_settings['plugins']['stylescombo']['styles'] = "h1.title|Title\np.callout|Callout\n\n";
    $editor = entity_load('editor', 'filtered_html');
    $editor = Editor::load('filtered_html');
    $this->assertTrue($editor instanceof Editor, 'An Editor config entity exists.');
    $this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');

@@ -169,7 +169,7 @@ function testExistingFormat() {
      'editor[settings][toolbar][button_groups]' => json_encode($expected_settings['toolbar']['rows']),
    );
    $this->drupalPostForm(NULL, $edit, t('Save configuration'));
    $editor = entity_load('editor', 'filtered_html');
    $editor = Editor::load('filtered_html');
    $this->assertTrue($editor instanceof Editor, 'An Editor config entity exists.');
    $this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');

@@ -197,7 +197,7 @@ function testExistingFormat() {
    $this->drupalGet('admin/config/content/formats/manage/filtered_html');
    $ultra_llama_mode_checkbox = $this->xpath('//input[@type="checkbox" and @name="editor[settings][plugins][llama_contextual_and_button][ultra_llama_mode]" and not(@checked)]');
    $this->assertTrue(count($ultra_llama_mode_checkbox) === 1, 'The "Ultra llama mode" checkbox exists and is not checked.');
    $editor = entity_load('editor', 'filtered_html');
    $editor = Editor::load('filtered_html');
    $this->assertTrue($editor instanceof Editor, 'An Editor config entity exists.');
    $this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');

@@ -211,7 +211,7 @@ function testExistingFormat() {
    $ultra_llama_mode_checkbox = $this->xpath('//input[@type="checkbox" and @name="editor[settings][plugins][llama_contextual_and_button][ultra_llama_mode]" and @checked="checked"]');
    $this->assertTrue(count($ultra_llama_mode_checkbox) === 1, 'The "Ultra llama mode" checkbox exists and is checked.');
    $expected_settings['plugins']['llama_contextual_and_button']['ultra_llama_mode'] = TRUE;
    $editor = entity_load('editor', 'filtered_html');
    $editor = Editor::load('filtered_html');
    $this->assertTrue($editor instanceof Editor, 'An Editor config entity exists.');
    $this->assertEqual($expected_settings, $editor->getSettings());
  }
@@ -247,7 +247,7 @@ function testNewFormat() {
    $this->drupalPostAjaxForm(NULL, $edit, 'editor_configure');
    $filter_format = entity_load('filter_format', 'amazing_format');
    $this->assertFalse($filter_format, 'No FilterFormat config entity exists yet.');
    $editor = entity_load('editor', 'amazing_format');
    $editor = Editor::load('amazing_format');
    $this->assertFalse($editor, 'No Editor config entity exists yet.');

    // Ensure the toolbar buttons configuration value is initialized to the
@@ -276,7 +276,7 @@ function testNewFormat() {
    // Ensure an Editor object exists now, with the proper settings.
    $expected_settings = $default_settings;
    $expected_settings['plugins']['stylescombo']['styles'] = '';
    $editor = entity_load('editor', 'amazing_format');
    $editor = Editor::load('amazing_format');
    $this->assertTrue($editor instanceof Editor, 'An Editor config entity exists now.');
    $this->assertEqual($this->castSafeStrings($expected_settings), $this->castSafeStrings($editor->getSettings()), 'The Editor config entity has the correct settings.');
  }
+1 −1
Changes for core/modules/ckeditor/src/Tests/CKEditorLoadingTest.php: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ function testLoading() {
    $this->drupalGet('node/add/article');
    list($settings, $editor_settings_present, $editor_js_present, $body, $format_selector) = $this->getThingsToCheck();
    $ckeditor_plugin = $this->container->get('plugin.manager.editor')->createInstance('ckeditor');
    $editor = entity_load('editor', 'filtered_html');
    $editor = Editor::load('filtered_html');
    $expected = array('formats' => array('filtered_html' => array(
      'format' => 'filtered_html',
      'editor' => 'ckeditor',
+5 −5
Changes for core/modules/ckeditor/tests/modules/src/Kernel/CKEditorTest.php: 5 added lines, 5 removed lines.
Original line number Diff line number Diff line
@@ -69,7 +69,7 @@ protected function setUp() {
   * Tests CKEditor::getJSSettings().
   */
  function testGetJSSettings() {
    $editor = entity_load('editor', 'filtered_html');
    $editor = Editor::load('filtered_html');

    // Default toolbar.
    $expected_config = $this->getDefaultInternalConfig() + array(
@@ -217,7 +217,7 @@ function testGetJSSettings() {
   * Tests CKEditor::buildToolbarJSSetting().
   */
  function testBuildToolbarJSSetting() {
    $editor = entity_load('editor', 'filtered_html');
    $editor = Editor::load('filtered_html');

    // Default toolbar.
    $expected = $this->getDefaultToolbarConfig();
@@ -248,7 +248,7 @@ function testBuildToolbarJSSetting() {
   * Tests CKEditor::buildContentsCssJSSetting().
   */
  function testBuildContentsCssJSSetting() {
    $editor = entity_load('editor', 'filtered_html');
    $editor = Editor::load('filtered_html');

    // Default toolbar.
    $expected = $this->getDefaultContentsCssConfig();
@@ -285,7 +285,7 @@ function testBuildContentsCssJSSetting() {
   * Tests Internal::getConfig().
   */
  function testInternalGetConfig() {
    $editor = entity_load('editor', 'filtered_html');
    $editor = Editor::load('filtered_html');
    $internal_plugin = $this->container->get('plugin.manager.ckeditor.plugin')->createInstance('internal');

    // Default toolbar.
@@ -306,7 +306,7 @@ function testInternalGetConfig() {
   * Tests StylesCombo::getConfig().
   */
  function testStylesComboGetConfig() {
    $editor = entity_load('editor', 'filtered_html');
    $editor = Editor::load('filtered_html');
    $stylescombo_plugin = $this->container->get('plugin.manager.ckeditor.plugin')->createInstance('stylescombo');

    // Styles dropdown/button enabled: new setting should be present.
+1 −1
Changes for core/modules/editor/editor.module: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -249,7 +249,7 @@ function editor_load($format_id) {
  // than one editor will be needed on a page (such as having multiple text
  // formats for administrators). Loading a small number of editors all at once
  // is more efficient than loading multiple editors individually.
  $editors = entity_load_multiple('editor');
  $editors = Editor::loadMultiple();
  return isset($editors[$format_id]) ? $editors[$format_id] : NULL;
}