function ToolkitTestTrait::getImage

Same name in other branches
  1. 10 core/tests/Drupal/Tests/Traits/Core/Image/ToolkitTestTrait.php \Drupal\Tests\Traits\Core\Image\ToolkitTestTrait::getImage()
  2. 11.x core/tests/Drupal/Tests/Traits/Core/Image/ToolkitTestTrait.php \Drupal\Tests\Traits\Core\Image\ToolkitTestTrait::getImage()

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;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.