public function EditorAdminTest::testNoEditorAvailable in Zircon Profile 8.0
Same name and namespace in other branches
- 8 core/modules/editor/src/Tests/EditorAdminTest.php \Drupal\editor\Tests\EditorAdminTest::testNoEditorAvailable()
Tests an existing format without any editors available.
File
- core/
modules/ editor/ src/ Tests/ EditorAdminTest.php, line 56 - Contains \Drupal\editor\Tests\EditorAdminTest.
Class
- EditorAdminTest
- Tests administration of text editors.
Namespace
Drupal\editor\TestsCode
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 <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
->assertTrue(count($select) === 1, 'The Text Editor select exists.');
$this
->assertTrue(count($select_is_disabled) === 1, 'The Text Editor select is disabled.');
$this
->assertTrue(count($options) === 1, 'The Text Editor select has only one option.');
$this
->assertTrue((string) $options[0] === 'None', 'Option 1 in the Text Editor select is "None".');
$this
->assertRaw(t('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.');
}