You are here

protected function ImageReplaceTestBase::imageIsOriginal in Image Replace 8

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

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

4 calls to ImageReplaceTestBase::imageIsOriginal()
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 131

Class

ImageReplaceTestBase
Tests functionality of the replace image effect.

Namespace

Drupal\image_replace\Tests

Code

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

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