Issue #2723587 by marvin_B8, snehi, Beau Townsend, valthebald, John Cook: Remove entity_load* usage for 'editor' entity type

8.2.x
Nathaniel Catchpole 2016-05-17 10:46:34 +01:00
parent 4bc14c7294
commit 4c4a0396ba
4 changed files with 16 additions and 16 deletions

View File

@ -55,7 +55,7 @@ class CKEditorAdminTest extends WebTestBase {
$this->drupalGet('admin/config/content/formats/manage/filtered_html'); $this->drupalGet('admin/config/content/formats/manage/filtered_html');
// Ensure no Editor config entity exists yet. // 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.'); $this->assertFalse($editor, 'No Editor config entity exists yet.');
// Verify the "Text Editor" <select> when a text editor is available. // Verify the "Text Editor" <select> when a text editor is available.
@ -111,7 +111,7 @@ class CKEditorAdminTest extends WebTestBase {
// Keep the "CKEditor" editor selected and click the "Configure" button. // Keep the "CKEditor" editor selected and click the "Configure" button.
$this->drupalPostAjaxForm(NULL, $edit, 'editor_configure'); $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.'); $this->assertFalse($editor, 'No Editor config entity exists yet.');
// Ensure that drupalSettings is correct. // Ensure that drupalSettings is correct.
@ -142,7 +142,7 @@ class CKEditorAdminTest extends WebTestBase {
// Ensure an Editor object exists now, with the proper settings. // Ensure an Editor object exists now, with the proper settings.
$expected_settings = $expected_default_settings; $expected_settings = $expected_default_settings;
$expected_settings['plugins']['stylescombo']['styles'] = ''; $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->assertTrue($editor instanceof Editor, 'An Editor config entity exists now.');
$this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.'); $this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');
@ -153,7 +153,7 @@ class CKEditorAdminTest extends WebTestBase {
); );
$this->drupalPostForm(NULL, $edit, t('Save configuration')); $this->drupalPostForm(NULL, $edit, t('Save configuration'));
$expected_settings['plugins']['stylescombo']['styles'] = "h1.title|Title\np.callout|Callout\n\n"; $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->assertTrue($editor instanceof Editor, 'An Editor config entity exists.');
$this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.'); $this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');
@ -169,7 +169,7 @@ class CKEditorAdminTest extends WebTestBase {
'editor[settings][toolbar][button_groups]' => json_encode($expected_settings['toolbar']['rows']), 'editor[settings][toolbar][button_groups]' => json_encode($expected_settings['toolbar']['rows']),
); );
$this->drupalPostForm(NULL, $edit, t('Save configuration')); $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->assertTrue($editor instanceof Editor, 'An Editor config entity exists.');
$this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.'); $this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');
@ -197,7 +197,7 @@ class CKEditorAdminTest extends WebTestBase {
$this->drupalGet('admin/config/content/formats/manage/filtered_html'); $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)]'); $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.'); $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->assertTrue($editor instanceof Editor, 'An Editor config entity exists.');
$this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.'); $this->assertEqual($expected_settings, $editor->getSettings(), 'The Editor config entity has the correct settings.');
@ -211,7 +211,7 @@ class CKEditorAdminTest extends WebTestBase {
$ultra_llama_mode_checkbox = $this->xpath('//input[@type="checkbox" and @name="editor[settings][plugins][llama_contextual_and_button][ultra_llama_mode]" and @checked="checked"]'); $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.'); $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; $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->assertTrue($editor instanceof Editor, 'An Editor config entity exists.');
$this->assertEqual($expected_settings, $editor->getSettings()); $this->assertEqual($expected_settings, $editor->getSettings());
} }
@ -247,7 +247,7 @@ class CKEditorAdminTest extends WebTestBase {
$this->drupalPostAjaxForm(NULL, $edit, 'editor_configure'); $this->drupalPostAjaxForm(NULL, $edit, 'editor_configure');
$filter_format = entity_load('filter_format', 'amazing_format'); $filter_format = entity_load('filter_format', 'amazing_format');
$this->assertFalse($filter_format, 'No FilterFormat config entity exists yet.'); $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.'); $this->assertFalse($editor, 'No Editor config entity exists yet.');
// Ensure the toolbar buttons configuration value is initialized to the // Ensure the toolbar buttons configuration value is initialized to the
@ -276,7 +276,7 @@ class CKEditorAdminTest extends WebTestBase {
// Ensure an Editor object exists now, with the proper settings. // Ensure an Editor object exists now, with the proper settings.
$expected_settings = $default_settings; $expected_settings = $default_settings;
$expected_settings['plugins']['stylescombo']['styles'] = ''; $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->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.'); $this->assertEqual($this->castSafeStrings($expected_settings), $this->castSafeStrings($editor->getSettings()), 'The Editor config entity has the correct settings.');
} }

View File

@ -100,7 +100,7 @@ class CKEditorLoadingTest extends WebTestBase {
$this->drupalGet('node/add/article'); $this->drupalGet('node/add/article');
list($settings, $editor_settings_present, $editor_js_present, $body, $format_selector) = $this->getThingsToCheck(); list($settings, $editor_settings_present, $editor_js_present, $body, $format_selector) = $this->getThingsToCheck();
$ckeditor_plugin = $this->container->get('plugin.manager.editor')->createInstance('ckeditor'); $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( $expected = array('formats' => array('filtered_html' => array(
'format' => 'filtered_html', 'format' => 'filtered_html',
'editor' => 'ckeditor', 'editor' => 'ckeditor',

View File

@ -69,7 +69,7 @@ class CKEditorTest extends KernelTestBase {
* Tests CKEditor::getJSSettings(). * Tests CKEditor::getJSSettings().
*/ */
function testGetJSSettings() { function testGetJSSettings() {
$editor = entity_load('editor', 'filtered_html'); $editor = Editor::load('filtered_html');
// Default toolbar. // Default toolbar.
$expected_config = $this->getDefaultInternalConfig() + array( $expected_config = $this->getDefaultInternalConfig() + array(
@ -217,7 +217,7 @@ class CKEditorTest extends KernelTestBase {
* Tests CKEditor::buildToolbarJSSetting(). * Tests CKEditor::buildToolbarJSSetting().
*/ */
function testBuildToolbarJSSetting() { function testBuildToolbarJSSetting() {
$editor = entity_load('editor', 'filtered_html'); $editor = Editor::load('filtered_html');
// Default toolbar. // Default toolbar.
$expected = $this->getDefaultToolbarConfig(); $expected = $this->getDefaultToolbarConfig();
@ -248,7 +248,7 @@ class CKEditorTest extends KernelTestBase {
* Tests CKEditor::buildContentsCssJSSetting(). * Tests CKEditor::buildContentsCssJSSetting().
*/ */
function testBuildContentsCssJSSetting() { function testBuildContentsCssJSSetting() {
$editor = entity_load('editor', 'filtered_html'); $editor = Editor::load('filtered_html');
// Default toolbar. // Default toolbar.
$expected = $this->getDefaultContentsCssConfig(); $expected = $this->getDefaultContentsCssConfig();
@ -285,7 +285,7 @@ class CKEditorTest extends KernelTestBase {
* Tests Internal::getConfig(). * Tests Internal::getConfig().
*/ */
function testInternalGetConfig() { function testInternalGetConfig() {
$editor = entity_load('editor', 'filtered_html'); $editor = Editor::load('filtered_html');
$internal_plugin = $this->container->get('plugin.manager.ckeditor.plugin')->createInstance('internal'); $internal_plugin = $this->container->get('plugin.manager.ckeditor.plugin')->createInstance('internal');
// Default toolbar. // Default toolbar.
@ -306,7 +306,7 @@ class CKEditorTest extends KernelTestBase {
* Tests StylesCombo::getConfig(). * Tests StylesCombo::getConfig().
*/ */
function testStylesComboGetConfig() { function testStylesComboGetConfig() {
$editor = entity_load('editor', 'filtered_html'); $editor = Editor::load('filtered_html');
$stylescombo_plugin = $this->container->get('plugin.manager.ckeditor.plugin')->createInstance('stylescombo'); $stylescombo_plugin = $this->container->get('plugin.manager.ckeditor.plugin')->createInstance('stylescombo');
// Styles dropdown/button enabled: new setting should be present. // Styles dropdown/button enabled: new setting should be present.

View File

@ -249,7 +249,7 @@ function editor_load($format_id) {
// than one editor will be needed on a page (such as having multiple text // 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 // formats for administrators). Loading a small number of editors all at once
// is more efficient than loading multiple editors individually. // 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; return isset($editors[$format_id]) ? $editors[$format_id] : NULL;
} }