You are here

protected function EditorAdminTest::verifyUnicornEditorConfiguration in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 core/modules/editor/src/Tests/EditorAdminTest.php \Drupal\editor\Tests\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/src/Tests/EditorAdminTest.php
Tests adding a text editor to an existing text format.
EditorAdminTest::testAddEditorToNewFormat in core/modules/editor/src/Tests/EditorAdminTest.php
Tests adding a text editor to a new text format.

File

core/modules/editor/src/Tests/EditorAdminTest.php, line 226
Contains \Drupal\editor\Tests\EditorAdminTest.

Class

EditorAdminTest
Tests administration of text editors.

Namespace

Drupal\editor\Tests

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