You are here

protected function EditorAdminTest::verifyUnicornEditorConfiguration in Drupal 10

Same name and namespace in other branches
  1. 8 core/modules/editor/tests/src/Functional/EditorAdminTest.php \Drupal\Tests\editor\Functional\EditorAdminTest::verifyUnicornEditorConfiguration()
  2. 9 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.

File

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

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
    ->assertSame('unicorn', $editor
    ->getEditor(), 'The text editor is configured correctly.');
  $this
    ->assertSame($ponies_too, $settings['ponies_too'], 'The text editor settings are stored correctly.');
  $this
    ->drupalGet('admin/config/content/formats/manage/' . $format_id);
  $select = $this
    ->assertSession()
    ->selectExists('editor[editor]');
  $this
    ->assertFalse($select
    ->hasAttribute('disabled'));
  $options = $select
    ->findAll('css', 'option');
  $this
    ->assertCount(2, $options);
  $this
    ->assertTrue($options[1]
    ->isSelected(), 'Option 2 ("Unicorn Editor") is selected.');
}