You are here

protected function ThunderImageCompareTestTrait::storeDiffImage in Thunder 8.2

Store diff image to screenshot folder for possible debugging of test.

Parameters

string $expectedImageFile: Expected image.

array $compareResult: Result of Imagick::compareImages() execution.

1 call to ThunderImageCompareTestTrait::storeDiffImage()
ThunderImageCompareTestTrait::compareImages in tests/src/FunctionalJavascript/ThunderImageCompareTestTrait.php
Compare two images with allowed difference threshold.

File

tests/src/FunctionalJavascript/ThunderImageCompareTestTrait.php, line 171

Class

ThunderImageCompareTestTrait
Trait for creating and comparing of screenshots.

Namespace

Drupal\Tests\thunder\FunctionalJavascript

Code

protected function storeDiffImage($expectedImageFile, array $compareResult) {
  $fileName = $this
    ->getScreenshotFolder() . '/' . basename($expectedImageFile) . '_' . date('Ymd_His') . '.png';
  file_put_contents($fileName, $compareResult[0]);
}