diff --git a/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php b/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php similarity index 87% rename from core/modules/ckeditor/src/Tests/CKEditorAdminTest.php rename to core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php index 669dc5f..09d97b0 100644 --- a/core/modules/ckeditor/src/Tests/CKEditorAdminTest.php +++ b/core/modules/ckeditor/tests/src/Functional/CKEditorAdminTest.php @@ -1,19 +1,19 @@ xpath('//select[@name="editor[editor]"]'); $select_is_disabled = $this->xpath('//select[@name="editor[editor]" and @disabled="disabled"]'); $options = $this->xpath('//select[@name="editor[editor]"]/option'); - $this->assertTrue(count($select) === 1, 'The Text Editor select exists.'); - $this->assertTrue(count($select_is_disabled) === 0, 'The Text Editor select is not disabled.'); - $this->assertTrue(count($options) === 2, 'The Text Editor select has two options.'); - $this->assertTrue(((string) $options[0]) === 'None', 'Option 1 in the Text Editor select is "None".'); - $this->assertTrue(((string) $options[1]) === 'CKEditor', 'Option 2 in the Text Editor select is "CKEditor".'); - $this->assertTrue(((string) $options[0]['selected']) === 'selected', 'Option 1 ("None") is selected.'); + $this->assertCount(1, $select, 'The Text Editor select exists.'); + $this->assertCount(0, $select_is_disabled, 'The Text Editor select is not disabled.'); + $this->assertCount(2, $options, 'The Text Editor select has two options.'); + $this->assertSame('None', $options[0]->getText(), 'Option 1 in the Text Editor select is "None".'); + $this->assertSame('CKEditor', $options[1]->getText(), 'Option 2 in the Text Editor select is "CKEditor".'); + $this->assertSame('selected', $options[0]->getAttribute('selected'), 'Option 1 ("None") is selected.'); // Select the "CKEditor" editor and click the "Save configuration" button. $edit = [ @@ -110,7 +110,7 @@ public function testExistingFormat() { $this->assertIdentical($this->castSafeStrings($ckeditor->getDefaultSettings()), $expected_default_settings); // Keep the "CKEditor" editor selected and click the "Configure" button. - $this->drupalPostAjaxForm(NULL, $edit, 'editor_configure'); + $this->drupalPostForm(NULL, $edit, 'editor_configure'); $editor = Editor::load('filtered_html'); $this->assertFalse($editor, 'No Editor config entity exists yet.'); @@ -120,8 +120,10 @@ public function testExistingFormat() { '#editor' => Editor::create(['editor' => 'ckeditor']), '#plugins' => $this->container->get('plugin.manager.ckeditor.plugin')->getButtons(), ]; + $settings = $this->getDrupalSettings(); + $expected = $settings['ckeditor']['toolbarAdmin']; $this->assertEqual( - $this->drupalSettings['ckeditor']['toolbarAdmin'], + $expected, $this->container->get('renderer')->renderPlain($ckeditor_settings_toolbar), 'CKEditor toolbar settings are rendered as part of drupalSettings.' ); @@ -230,12 +232,12 @@ public function testNewFormat() { $select = $this->xpath('//select[@name="editor[editor]"]'); $select_is_disabled = $this->xpath('//select[@name="editor[editor]" and @disabled="disabled"]'); $options = $this->xpath('//select[@name="editor[editor]"]/option'); - $this->assertTrue(count($select) === 1, 'The Text Editor select exists.'); - $this->assertTrue(count($select_is_disabled) === 0, 'The Text Editor select is not disabled.'); - $this->assertTrue(count($options) === 2, 'The Text Editor select has two options.'); - $this->assertTrue(((string) $options[0]) === 'None', 'Option 1 in the Text Editor select is "None".'); - $this->assertTrue(((string) $options[1]) === 'CKEditor', 'Option 2 in the Text Editor select is "CKEditor".'); - $this->assertTrue(((string) $options[0]['selected']) === 'selected', 'Option 1 ("None") is selected.'); + $this->assertSame(1, count($select), 'The Text Editor select exists.'); + $this->assertSame(0, count($select_is_disabled), 'The Text Editor select is not disabled.'); + $this->assertSame(2, count($options), 'The Text Editor select has two options.'); + $this->assertSame('None', $options[0]->getText(), 'Option 1 in the Text Editor select is "None".'); + $this->assertSame('CKEditor', $options[1]->getText(), 'Option 2 in the Text Editor select is "CKEditor".'); + $this->assertSame('selected', $options[0]->getAttribute('selected'), 'Option 1 ("None") is selected.'); // Name our fancy new text format, select the "CKEditor" editor and click // the "Configure" button. @@ -244,7 +246,7 @@ public function testNewFormat() { 'format' => 'amazing_format', 'editor[editor]' => 'ckeditor', ]; - $this->drupalPostAjaxForm(NULL, $edit, 'editor_configure'); + $this->drupalPostForm(NULL, $edit, 'editor_configure'); $filter_format = FilterFormat::load('amazing_format'); $this->assertFalse($filter_format, 'No FilterFormat config entity exists yet.'); $editor = Editor::load('amazing_format'); @@ -258,7 +260,9 @@ public function testNewFormat() { $this->assertFieldByName('editor[settings][toolbar][button_groups]', $expected_buttons_value); // Regression test for https://www.drupal.org/node/2606460. - $this->assertTrue(strpos($this->drupalSettings['ckeditor']['toolbarAdmin'], '
  • bold
  • ') !== FALSE); + $settings = $this->getDrupalSettings(); + $expected = $settings['ckeditor']['toolbarAdmin']; + $this->assertTrue(strpos($expected, '
  • bold
  • ') !== FALSE); // Ensure the styles textarea exists and is initialized empty. $styles_textarea = $this->xpath('//textarea[@name="editor[settings][plugins][stylescombo][styles]"]'); diff --git a/core/modules/ckeditor/src/Tests/CKEditorLoadingTest.php b/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php similarity index 98% rename from core/modules/ckeditor/src/Tests/CKEditorLoadingTest.php rename to core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php index 438aeba..9d66071 100644 --- a/core/modules/ckeditor/src/Tests/CKEditorLoadingTest.php +++ b/core/modules/ckeditor/tests/src/Functional/CKEditorLoadingTest.php @@ -1,17 +1,17 @@