protected function ToolkitTestTrait::getImage in Drupal 10
Same name and namespace in other branches
- 9 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.
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\ImageCode
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;
}