protected function AnimatedGifFunctionalTestBase::getTestFile in Animated GIF 8
Helper method to get the tested file.
Parameters
string $fileName: The name of the file.
string $fileUri: The Uri of the file.
Return value
\Drupal\file\FileInterface Return a file.
Throws
\Drupal\Component\Plugin\Exception\InvalidPluginDefinitionException
\Drupal\Component\Plugin\Exception\PluginNotFoundException
1 call to AnimatedGifFunctionalTestBase::getTestFile()
- AnimatedGifFieldTest::gifAnimationTest in tests/
src/ Functional/ AnimatedGifFieldTest.php - Helper method to test the image styles modifications.
File
- tests/
src/ Functional/ AnimatedGifFunctionalTestBase.php, line 103
Class
- AnimatedGifFunctionalTestBase
- Base class for Animated GIF functional tests.
Namespace
Drupal\Tests\animated_gif\FunctionalCode
protected function getTestFile(string $fileName, string $fileUri) : FileInterface {
// Copy the source file to public directory.
$source = drupal_get_path('module', 'animated_gif');
$source .= '/tests/images/' . $fileName;
$this->fileSystem
->copy($source, $fileUri, FileSystemInterface::EXISTS_REPLACE);
/** @var \Drupal\file\FileInterface $file */
$file = $this->entityTypeManager
->getStorage('file')
->create([
'filename' => $fileName,
'filemime' => 'image/gif',
'uri' => $fileUri,
]);
return $file;
}