public function EditorAdminTest::testNoEditorAvailable in Drupal 10
Same name and namespace in other branches
- 8 core/modules/editor/tests/src/Functional/EditorAdminTest.php \Drupal\Tests\editor\Functional\EditorAdminTest::testNoEditorAvailable()
- 9 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
->assertGreaterThan($roles_pos, $editor_pos);
$this
->assertLessThan($filters_pos, $editor_pos);
// Verify the <select>.
$select = $this
->assertSession()
->selectExists('editor[editor]');
$this
->assertSame('disabled', $select
->getAttribute('disabled'));
$options = $select
->findAll('css', 'option');
$this
->assertCount(1, $options);
$this
->assertSame('None', $options[0]
->getText(), 'Option 1 in the Text Editor select is "None".');
$this
->assertSession()
->pageTextContains('This option is disabled because no modules that provide a text editor are currently enabled.');
}