You are here

protected function ToolkitTestTrait::getImage in Drupal 9

Sets up an image with the custom toolkit.

Return value

\Drupal\Core\Image\ImageInterface The image object.

3 calls to ToolkitTestTrait::getImage()
ToolkitTest::setUp in core/tests/Drupal/KernelTests/Core/Image/ToolkitTest.php
ToolkitTest::testLoad in core/tests/Drupal/KernelTests/Core/Image/ToolkitTest.php
Tests Image's methods.
ToolkitTestTrait::assertImageEffect in core/tests/Drupal/Tests/Traits/Core/Image/ToolkitTestTrait.php
Asserts the effect processing of an image effect plugin.

File

core/tests/Drupal/Tests/Traits/Core/Image/ToolkitTestTrait.php, line 82

Class

ToolkitTestTrait
Provides common methods for image toolkit kernel tests.

Namespace

Drupal\Tests\Traits\Core\Image

Code

protected function getImage() : ImageInterface {
  $image_factory = \Drupal::service('image.factory');
  $file = current($this
    ->drupalGetTestFiles('image'));
  $image = $image_factory
    ->get($file->uri, 'test');
  $this
    ->assertTrue($image
    ->isValid());
  return $image;
}