function EditorAdminTest::testNoEditorAvailable
Same name in other branches
- 9 core/modules/editor/tests/src/Functional/EditorAdminTest.php \Drupal\Tests\editor\Functional\EditorAdminTest::testNoEditorAvailable()
- 10 core/modules/editor/tests/src/Functional/EditorAdminTest.php \Drupal\Tests\editor\Functional\EditorAdminTest::testNoEditorAvailable()
- 11.x core/modules/editor/tests/src/Functional/EditorAdminTest.php \Drupal\Tests\editor\Functional\EditorAdminTest::testNoEditorAvailable()
Tests an existing format without any editors available.
File
-
core/
modules/ editor/ tests/ src/ Functional/ EditorAdminTest.php, line 56
Class
- EditorAdminTest
- Tests administration of text editors.
Namespace
Drupal\Tests\editor\FunctionalCode
public function testNoEditorAvailable() {
$this->drupalLogin($this->adminUser);
$this->drupalGet('admin/config/content/formats/manage/filtered_html');
// Ensure the form field order is correct.
$raw_content = $this->getSession()
->getPage()
->getContent();
$roles_pos = strpos($raw_content, 'Roles');
$editor_pos = strpos($raw_content, 'Text editor');
$filters_pos = strpos($raw_content, '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 <select>.
$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->assertCount(1, $select, 'The Text Editor select exists.');
$this->assertCount(1, $select_is_disabled, 'The Text Editor select is disabled.');
$this->assertCount(1, $options, 'The Text Editor select has only one option.');
$this->assertTrue($options[0]->getText() === 'None', 'Option 1 in the Text Editor select is "None".');
$this->assertRaw('This option is disabled because no modules that provide a text editor are currently enabled.', 'Description for select present that tells users to install a text editor module.');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.