You are here

protected function ImageReplaceTestBase::imageIsReplacement in Image Replace 8

Same name and namespace in other branches
  1. 7 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 152

Class

ImageReplaceTestBase
Tests functionality of the replace image effect.

Namespace

Drupal\image_replace\Tests

Code

protected function imageIsReplacement($image_uri) {
  $expected_info = [
    'height' => 60,
    'mime_type' => 'image/png',
    'width' => 80,
  ];
  $image = \Drupal::service('image.factory')
    ->get($image_uri);
  $image_info = [
    'height' => $image
      ->getHeight(),
    'mime_type' => $image
      ->getMimeType(),
    'width' => $image
      ->getWidth(),
  ];

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