You are here

protected function ImageReplaceTestBase::imageIsReplacement in Image Replace 7

Same name and namespace in other branches
  1. 8 src/Tests/ImageReplaceTestBase.php \Drupal\image_replace\Tests\ImageReplaceTestBase::imageIsReplacement()

Returns TRUE if the image pointed at by the URI is the replacement image.

4 calls to ImageReplaceTestBase::imageIsReplacement()
AdminTest::testFieldEditUi in src/Tests/AdminTest.php
Tests image replacement on node entities.
EntityTest::testNodeView in src/Tests/EntityTest.php
Tests image replacement on node entities.
ImageReplaceTestBase::createTestFiles in src/Tests/ImageReplaceTestBase.php
Create a pair of test files.
ReplaceEffectTest::testReplaceEffect in src/Tests/ReplaceEffectTest.php
Tests functionality of the replace image effect.

File

src/Tests/ImageReplaceTestBase.php, line 127

Class

ImageReplaceTestBase
Tests functionality of the replace image effect.

Namespace

Drupal\image_replace\Tests

Code

protected function imageIsReplacement($image_uri) {
  $expected_info = array(
    'extension' => 'png',
    'height' => 60,
    'mime_type' => 'image/png',
    'width' => 80,
  );
  $image_info = image_get_info($image_uri);
  unset($image_info['file_size']);
  ksort($image_info);

  // FIXME: Assert that replacement image has a green pixel on x=40, y=30.
  return $expected_info === $image_info;
}