You are here

public function TextFormatConfigurationTest::testUrlWeightOrder in Video Embed Field 8

Same name and namespace in other branches
  1. 8.2 modules/video_embed_wysiwyg/tests/src/Functional/TextFormatConfigurationTest.php \Drupal\Tests\video_embed_wysiwyg\Functional\TextFormatConfigurationTest::testUrlWeightOrder()

Test the URL filter weight is in the correct order.

File

modules/video_embed_wysiwyg/tests/src/Functional/TextFormatConfigurationTest.php, line 90

Class

TextFormatConfigurationTest
Test the format configuration form.

Namespace

Drupal\Tests\video_embed_wysiwyg\Functional

Code

public function testUrlWeightOrder() {
  $this
    ->drupalGet($this->formatUrl);
  $this
    ->submitForm([
    // Enable the URL filter and the WYSIWYG embed.
    'filters[filter_url][status]' => TRUE,
    'filters[filter_html][status]' => FALSE,
    'filters[video_embed_wysiwyg][status]' => TRUE,
    'editor[settings][toolbar][button_groups]' => '[[{"name":"Group","items":["video_embed"]}]]',
    // Setup the weights so the URL filter runs first.
    'filters[video_embed_wysiwyg][weight]' => '10',
    'filters[filter_url][weight]' => '-10',
  ], 'Save configuration');
  $this
    ->assertSession()
    ->pageTextContains('The "Video Embed WYSIWYG" filter must run before the "Convert URLs into links" filter to function correctly.');

  // Submit the form with the weights reversed.
  $this
    ->submitForm([
    'filters[video_embed_wysiwyg][weight]' => '-10',
    'filters[filter_url][weight]' => '10',
  ], 'Save configuration');
  $this
    ->assertSession()
    ->pageTextContains('The text format Plain text has been updated.');
}