protected function ImageEffectsTestBase::getTestImageCopyUri in Image Effects 8
Same name and namespace in other branches
- 8.3 tests/src/Functional/ImageEffectsTestBase.php \Drupal\Tests\image_effects\Functional\ImageEffectsTestBase::getTestImageCopyUri()
- 8.2 tests/src/Functional/ImageEffectsTestBase.php \Drupal\Tests\image_effects\Functional\ImageEffectsTestBase::getTestImageCopyUri()
Get the URI of the test image file copied to a safe location.
Parameters
string $path: The path to the test image file.
string $name: (optional) The name of the item for which the path is requested. Ignored for $type 'core'. If null, $path is returned. Defaults to null.
string $type: (optional) The type of the item; one of 'core', 'profile', 'module', 'theme', or 'theme_engine'. Defaults to 'module'.
23 calls to ImageEffectsTestBase::getTestImageCopyUri()
- AutoOrientTest::testAutoOrientEffect in tests/
src/ Functional/ Effect/ AutoOrientTest.php - Auto Orientation effect test.
- BackgroundTest::testBackgroundEffect in tests/
src/ Functional/ Effect/ BackgroundTest.php - Background effect test.
- BrightnessTest::testBrightnessEffect in tests/
src/ Functional/ Effect/ BrightnessTest.php - Brightness effect test.
- ColorShiftTest::testColorShiftEffect in tests/
src/ Functional/ Effect/ ColorShiftTest.php - Color Shift effect test.
- ContrastTest::testContrastEffect in tests/
src/ Functional/ Effect/ ContrastTest.php - Contrast effect test.
File
- tests/
src/ Functional/ ImageEffectsTestBase.php, line 244
Class
- ImageEffectsTestBase
- Base test class for image_effects tests.
Namespace
Drupal\Tests\image_effects\FunctionalCode
protected function getTestImageCopyUri($path, $name = NULL, $type = 'module') {
$test_directory = 'public://test-images/';
file_prepare_directory($test_directory, FILE_CREATE_DIRECTORY);
$source_uri = $name ? drupal_get_path($type, $name) : '';
$source_uri .= $path;
$target_uri = $test_directory . \Drupal::service('file_system')
->basename($source_uri);
return file_unmanaged_copy($source_uri, $target_uri, FILE_EXISTS_REPLACE);
}