function EditorAdminTest::selectUnicornEditor

Same name in other branches
  1. 9 core/modules/editor/tests/src/Functional/EditorAdminTest.php \Drupal\Tests\editor\Functional\EditorAdminTest::selectUnicornEditor()
  2. 8.9.x core/modules/editor/tests/src/Functional/EditorAdminTest.php \Drupal\Tests\editor\Functional\EditorAdminTest::selectUnicornEditor()
  3. 11.x core/modules/editor/tests/src/Functional/EditorAdminTest.php \Drupal\Tests\editor\Functional\EditorAdminTest::selectUnicornEditor()

Tests and selects the unicorn editor.

Return value

array Returns an edit array containing the values to be posted.

3 calls to EditorAdminTest::selectUnicornEditor()
EditorAdminTest::addEditorToNewFormat in core/modules/editor/tests/src/Functional/EditorAdminTest.php
Adds an editor to a new format using the UI.
EditorAdminTest::testAddEditorToExistingFormat in core/modules/editor/tests/src/Functional/EditorAdminTest.php
Tests adding a text editor to an existing text format.
EditorAdminTest::testSwitchEditorToNone in core/modules/editor/tests/src/Functional/EditorAdminTest.php
Tests switching text editor to none does not throw a TypeError.

File

core/modules/editor/tests/src/Functional/EditorAdminTest.php, line 212

Class

EditorAdminTest
Tests administration of text editors.

Namespace

Drupal\Tests\editor\Functional

Code

protected function selectUnicornEditor() {
    // Verify the <select> when a text editor is available.
    $select = $this->assertSession()
        ->selectExists('editor[editor]');
    $this->assertFalse($select->hasAttribute('disabled'));
    $options = $select->findAll('css', 'option');
    $this->assertCount(2, $options);
    $this->assertSame('None', $options[0]->getText(), 'Option 1 in the Text Editor select is "None".');
    $this->assertSame('Unicorn Editor', $options[1]->getText(), 'Option 2 in the Text Editor select is "Unicorn Editor".');
    $this->assertTrue($options[0]->hasAttribute('selected'), 'Option 1 ("None") is selected.');
    // Ensure the none option is selected.
    $this->assertSession()
        ->pageTextNotContains('This option is disabled because no modules that provide a text editor are currently enabled.');
    // Select the "Unicorn Editor" editor and click the "Configure" button.
    $edit = [
        'editor[editor]' => 'unicorn',
    ];
    $this->submitForm($edit, 'Configure');
    $this->assertSession()
        ->checkboxChecked('editor[settings][ponies_too]');
    return $edit;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.