function ImageAdminStylesTest::createSampleImage in Zircon Profile 8
Same name and namespace in other branches
- 8.0 core/modules/image/src/Tests/ImageAdminStylesTest.php \Drupal\image\Tests\ImageAdminStylesTest::createSampleImage()
Given an image style, generate an image.
1 call to ImageAdminStylesTest::createSampleImage()
- ImageAdminStylesTest::testStyle in core/
modules/ image/ src/ Tests/ ImageAdminStylesTest.php - General test to add a style, add/remove/edit effects to it, then delete it.
File
- core/
modules/ image/ src/ Tests/ ImageAdminStylesTest.php, line 26 - Contains \Drupal\image\Tests\ImageAdminStylesTest.
Class
- ImageAdminStylesTest
- Tests creation, deletion, and editing of image styles and effects.
Namespace
Drupal\image\TestsCode
function createSampleImage(ImageStyleInterface $style) {
static $file_path;
// First, we need to make sure we have an image in our testing
// file directory. Copy over an image on the first run.
if (!isset($file_path)) {
$files = $this
->drupalGetTestFiles('image');
$file = reset($files);
$file_path = file_unmanaged_copy($file->uri);
}
return $style
->buildUrl($file_path) ? $file_path : FALSE;
}