core/modules/editor/src/Tests/EditorAdminTest.php | 20 +++++++++----------- .../modules/config/schema/editor_test.schema.yml | 2 +- .../modules/src/Plugin/Editor/UnicornEditor.php | 8 ++++---- 3 files changed, 14 insertions(+), 16 deletions(-) diff --git a/core/modules/editor/src/Tests/EditorAdminTest.php b/core/modules/editor/src/Tests/EditorAdminTest.php index d4b880c..8e6ebd1 100644 --- a/core/modules/editor/src/Tests/EditorAdminTest.php +++ b/core/modules/editor/src/Tests/EditorAdminTest.php @@ -84,9 +84,9 @@ public function testAddEditorToExistingFormat() { $this->drupalGet('admin/config/content/formats/manage/filtered_html'); $edit = $this->selectUnicornEditor(); // Configure Unicorn Editor's setting to another value. - $edit['editor[settings][foo]'] = 'baz'; + $edit['editor[settings][ponies_too]'] = FALSE; $this->drupalPostForm(NULL, $edit, t('Save configuration')); - $this->verifyUnicornEditorConfiguration('filtered_html', 'baz'); + $this->verifyUnicornEditorConfiguration('filtered_html', FALSE); } /** @@ -111,8 +111,6 @@ public function testAddEditorToNewFormat() { */ protected function enableUnicornEditor() { \Drupal::service('module_installer')->install(array('editor_test')); - $this->rebuildContainer(); - $this->resetAll(); } /** @@ -140,8 +138,8 @@ protected function selectUnicornEditor() { 'editor[editor]' => 'unicorn', ); $this->drupalPostAjaxForm(NULL, $edit, 'editor_configure'); - $unicorn_setting_foo = $this->xpath('//input[@name="editor[settings][foo]" and @type="text" and @value="bar"]'); - $this->assertTrue(count($unicorn_setting_foo), "Unicorn Editor's settings form is present."); + $unicorn_setting = $this->xpath('//input[@name="editor[settings][ponies_too]" and @type="checkbox" and @checked]'); + $this->assertTrue(count($unicorn_setting), "Unicorn Editor's settings form is present."); return $edit; } @@ -151,15 +149,15 @@ protected function selectUnicornEditor() { * * @param string $format_id * The format machine name. - * @param string $foo - * The expected value of the foo setting. + * @param string $ponies_too + * The expected value of the ponies_too setting. */ - protected function verifyUnicornEditorConfiguration($format_id, $foo = 'bar') { + protected function verifyUnicornEditorConfiguration($format_id, $ponies_too = TRUE) { $editor = editor_load($format_id); $settings = $editor->getSettings(); $this->assertIdentical($editor->getEditor(), 'unicorn', 'The text editor is configured correctly.'); - $this->assertIdentical($settings['foo'], $foo, 'The text editor settings are stored correctly.'); - $this->assertIdentical($settings['ponies_too'], true, 'The text editor defaults are retrieved correctly.'); + debug($settings); + $this->assertIdentical($settings['ponies_too'], $ponies_too, 'The text editor settings are stored correctly.'); $this->drupalGet('admin/config/content/formats/manage/'. $format_id); $select = $this->xpath('//select[@name="editor[editor]"]'); $select_is_disabled = $this->xpath('//select[@name="editor[editor]" and @disabled="disabled"]'); diff --git a/core/modules/editor/tests/modules/config/schema/editor_test.schema.yml b/core/modules/editor/tests/modules/config/schema/editor_test.schema.yml index 6900e2f..64d94f8 100644 --- a/core/modules/editor/tests/modules/config/schema/editor_test.schema.yml +++ b/core/modules/editor/tests/modules/config/schema/editor_test.schema.yml @@ -5,5 +5,5 @@ editor.settings.unicorn: label: 'Unicorn settings' mapping: ponies_too: - type: string + type: boolean label: 'Ponies too' diff --git a/core/modules/editor/tests/modules/src/Plugin/Editor/UnicornEditor.php b/core/modules/editor/tests/modules/src/Plugin/Editor/UnicornEditor.php index 49644e5..7539021 100644 --- a/core/modules/editor/tests/modules/src/Plugin/Editor/UnicornEditor.php +++ b/core/modules/editor/tests/modules/src/Plugin/Editor/UnicornEditor.php @@ -35,10 +35,10 @@ function getDefaultSettings() { * {@inheritdoc} */ function settingsForm(array $form, FormStateInterface $form_state, EditorEntity $editor) { - $form['foo'] = array( - '#title' => t('Foo'), - '#type' => 'textfield', - '#default_value' => 'bar', + $form['ponies_too'] = array( + '#title' => t('Pony mode'), + '#type' => 'checkbox', + '#default_value' => TRUE, ); return $form; }