You are here

protected function AnimatedGifFieldTest::gifAnimationTest in Animated GIF 8

Helper method to test the image styles modifications.

Parameters

string $fileName: The file name.

string $fileUri: The file uri.

bool $isAnimated: Set if it's animated.

Throws

\Behat\Mink\Exception\ResponseTextException

\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException

\Drupal\Component\Plugin\Exception\PluginNotFoundException

1 call to AnimatedGifFieldTest::gifAnimationTest()
AnimatedGifFieldTest::testGif in tests/src/Functional/AnimatedGifFieldTest.php
Method to test gif images.

File

tests/src/Functional/AnimatedGifFieldTest.php, line 101

Class

AnimatedGifFieldTest
Tests fields styles.

Namespace

Drupal\Tests\animated_gif\Functional

Code

protected function gifAnimationTest(string $fileName, string $fileUri, bool $isAnimated) : void {
  $this
    ->drupalLogin($this->adminUser);
  $nid = $this->node
    ->id();
  $this
    ->drupalGet("node/{$nid}/edit");
  $file = $this
    ->getTestFile($fileName, $fileUri);
  $this
    ->uploadImage($file);
  if ($isAnimated) {
    $this
      ->assertSession()
      ->pageTextContains('GIF images are not being processed by image styles, use with caution!');
  }
  else {
    $this
      ->assertSession()
      ->pageTextNotContains('GIF images are not being processed by image styles, use with caution!');
  }
}