$this->
config('system.file'
)->
set('default_scheme', 'temporary'
)->
save();
// Create the directories for the styles.
$directory =
$scheme . '://styles/' .
$this->style->
id();
$status = \Drupal::
service('file_system'
)->
prepareDirectory($directory, FileSystemInterface::CREATE_DIRECTORY
);
$this->
assertNotFalse($status, 'Created the directory for the generated images for the test style.'
);
// Override the language to build the URL for the correct language.
if ($langcode) { $language_manager = \Drupal::
service('language_manager'
);
$language =
$language_manager->
getLanguage($langcode);
$language_manager->
setConfigOverrideLanguage($language);
} // Create a working copy of the file.
$files =
$this->
drupalGetTestFiles('image'
);
$file =
array_shift($files);
/** @var \Drupal\Core\File\FileSystemInterface $file_system */
$file_system = \Drupal::
service('file_system'
);
$original_uri =
$file_system->
copy($file->uri,
$scheme . '://', FileSystemInterface::EXISTS_RENAME
);
// Let the image_module_test module know about this file, so it can claim
// ownership in hook_file_download().
\Drupal::
state()->
set('image.test_file_download',
$original_uri);