protected function EditorAdminTest::verifyUnicornEditorConfiguration

Verifies unicorn editor configuration.

Parameters

string $format_id: The format machine name.

string $foo: The expected value of the foo setting.

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

File

drupal/core/modules/editor/lib/Drupal/editor/Tests/EditorAdminTest.php, line 151
Definition of \Drupal\editor\Tests\EditorAdminTest.

Class

EditorAdminTest
Tests administration of text editors.

Namespace

Drupal\editor\Tests

Code

protected function verifyUnicornEditorConfiguration($format_id, $foo = 'bar') {
  $editor = editor_load($format_id);
  $this
    ->assertIdentical($editor->editor, 'unicorn', 'The text editor is configured correctly.');
  $this
    ->assertIdentical($editor->settings['foo'], $foo, 'The text editor settings are stored correctly.');
  $this
    ->assertIdentical($editor->settings['ponies too'], true, 'The text editor defaults are retrieved correctly.');
  $this
    ->assertIdentical($editor->settings['rainbows'], true, 'The text editor defaults added by hook_editor_settings_defaults() are retrieved correctly.');
  $this
    ->assertIdentical($editor->settings['sparkles'], false, 'The text editor defaults modified by hook_editor_settings_defaults_alter() are retrieved correctly.');
  $this
    ->drupalGet('admin/config/content/formats/' . $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.');
}