You are here

public function FormatterConfigurationTest::testVideoConfirmationForm in Video Embed Field 8

Same name and namespace in other branches
  1. 8.2 tests/src/Functional/FormatterConfigurationTest.php \Drupal\Tests\video_embed_field\Functional\FormatterConfigurationTest::testVideoConfirmationForm()

Test the formatter configuration forms.

File

tests/src/Functional/FormatterConfigurationTest.php, line 48

Class

FormatterConfigurationTest
Tests the field formatter configuration forms.

Namespace

Drupal\Tests\video_embed_field\Functional

Code

public function testVideoConfirmationForm() {

  // Test the settings form and summaries for the video formatter.
  $this
    ->setFormatter('video_embed_field_video');
  $this
    ->assertSession()
    ->pageTextContains('Embedded Video (Responsive, autoplaying).');
  $this
    ->updateFormatterSettings([
    'autoplay' => FALSE,
    'responsive' => FALSE,
    'width' => 100,
    'height' => 100,
  ]);
  $this
    ->assertSession()
    ->pageTextContains('Embedded Video (100x100).');

  // Test the image formatter.
  $this
    ->setFormatter('video_embed_field_thumbnail');
  $this
    ->assertSession()
    ->pageTextContains('Video thumbnail (no image style).');
  $this
    ->updateFormatterSettings([
    'image_style' => 'thumbnail',
    'link_image_to' => Thumbnail::LINK_CONTENT,
  ]);
  $this
    ->assertSession()
    ->pageTextContains('Video thumbnail (thumbnail, linked to content).');
  $this
    ->updateFormatterSettings([
    'image_style' => 'medium',
    'link_image_to' => Thumbnail::LINK_PROVIDER,
  ]);
  $this
    ->assertSession()
    ->pageTextContains('Video thumbnail (medium, linked to provider).');
  $this
    ->setFormatter('video_embed_field_colorbox');
  $this
    ->assertSession()
    ->pageTextContains('Thumbnail that launches a modal window.');
  $this
    ->assertSession()
    ->pageTextContains('Embedded Video (Responsive, autoplaying).');
  $this
    ->assertSession()
    ->pageTextContains('Video thumbnail (medium, linked to provider).');
  $this
    ->updateFormatterSettings([
    'autoplay' => FALSE,
    'responsive' => FALSE,
    'width' => 100,
    'height' => 100,
    'image_style' => 'medium',
    'link_image_to' => Thumbnail::LINK_PROVIDER,
  ]);
  $this
    ->assertSession()
    ->pageTextContains('Thumbnail that launches a modal window.');
  $this
    ->assertSession()
    ->pageTextContains('Embedded Video (100x100).');
  $this
    ->assertSession()
    ->pageTextContains('Video thumbnail (medium, linked to provider).');
}