X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Feditor%2Fsrc%2FTests%2FEditorAdminTest.php;fp=web%2Fcore%2Fmodules%2Feditor%2Fsrc%2FTests%2FEditorAdminTest.php;h=0000000000000000000000000000000000000000;hb=0bf8d09d2542548982e81a441b1f16e75873a04f;hp=4315a6dabd859cc93398f324b98741941f2792b2;hpb=74df008bdbb3a11eeea356744f39b802369bda3c;p=yaffs-website diff --git a/web/core/modules/editor/src/Tests/EditorAdminTest.php b/web/core/modules/editor/src/Tests/EditorAdminTest.php deleted file mode 100644 index 4315a6dab..000000000 --- a/web/core/modules/editor/src/Tests/EditorAdminTest.php +++ /dev/null @@ -1,236 +0,0 @@ - 'filtered_html', - 'name' => 'Filtered HTML', - 'weight' => 0, - 'filters' => [], - ]); - $filtered_html_format->save(); - - // Create admin user. - $this->adminUser = $this->drupalCreateUser(['administer filters']); - } - - /** - * Tests an existing format without any editors available. - */ - public function testNoEditorAvailable() { - $this->drupalLogin($this->adminUser); - $this->drupalGet('admin/config/content/formats/manage/filtered_html'); - - // Ensure the form field order is correct. - $roles_pos = strpos($this->getRawContent(), 'Roles'); - $editor_pos = strpos($this->getRawContent(), 'Text editor'); - $filters_pos = strpos($this->getRawContent(), 'Enabled filters'); - $this->assertTrue($roles_pos < $editor_pos && $editor_pos < $filters_pos, '"Text Editor" select appears in the correct location of the text format configuration UI.'); - - // Verify the when a text editor is available. - $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]) === 'Unicorn Editor', 'Option 2 in the Text Editor select is "Unicorn Editor".'); - $this->assertTrue(((string) $options[0]['selected']) === 'selected', 'Option 1 ("None") is selected.'); - // Ensure the none option is selected. - $this->assertNoRaw(t('This option is disabled because no modules that provide a text editor are currently enabled.'), 'Description for select absent that tells users to install a text editor module.'); - - // Select the "Unicorn Editor" editor and click the "Configure" button. - $edit = [ - 'editor[editor]' => 'unicorn', - ]; - $this->drupalPostAjaxForm(NULL, $edit, 'editor_configure'); - $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; - } - - /** - * Verifies unicorn editor configuration. - * - * @param string $format_id - * The format machine name. - * @param bool $ponies_too - * The expected value of the ponies_too setting. - */ - 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['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"]'); - $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[1]['selected']) === 'selected', 'Option 2 ("Unicorn Editor") is selected.'); - } - -}