function EditorAdminTest::verifyUnicornEditorConfiguration

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

Verifies unicorn editor configuration.

Parameters

string $format_id: The format machine name.

bool $ponies_too: The expected value of the ponies_too setting.

2 calls to EditorAdminTest::verifyUnicornEditorConfiguration()
EditorAdminTest::testAddEditorToExistingFormat in core/modules/editor/tests/src/Functional/EditorAdminTest.php
Tests adding a text editor to an existing text format.
EditorAdminTest::testAddEditorToNewFormat in core/modules/editor/tests/src/Functional/EditorAdminTest.php
Tests adding a text editor to a new text format.

File

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

Class

EditorAdminTest
Tests administration of text editors.

Namespace

Drupal\Tests\editor\Functional

Code

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->assertCount(1, $select, 'The Text Editor select exists.');
    $this->assertCount(0, $select_is_disabled, 'The Text Editor select is not disabled.');
    $this->assertCount(2, $options, 'The Text Editor select has two options.');
    $this->assertTrue($options[1]->hasAttribute('selected'), 'Option 2 ("Unicorn Editor") is selected.');
}

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