protected function BambooTwigLoaderTest::createFile in Bamboo Twig 8.3
Same name and namespace in other branches
- 8.5 tests/src/Functional/BambooTwigLoaderTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigLoaderTest::createFile()
- 8.2 tests/src/Functional/BambooTwigLoaderTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigLoaderTest::createFile()
- 8.4 tests/src/Functional/BambooTwigLoaderTest.php \Drupal\Tests\bamboo_twig\Functional\BambooTwigLoaderTest::createFile()
Creates and gets test image file.
Return value
\Drupal\file\FileInterface File object.
1 call to BambooTwigLoaderTest::createFile()
- BambooTwigLoaderTest::setUp in tests/
src/ Functional/ BambooTwigLoaderTest.php
File
- tests/
src/ Functional/ BambooTwigLoaderTest.php, line 141
Class
- BambooTwigLoaderTest
- Tests Loaders twig filters and functions.
Namespace
Drupal\Tests\bamboo_twig\FunctionalCode
protected function createFile() {
/** @var \Drupal\Component\PhpStorage\FileStorage $fileStorage */
$fileStorage = $this->container
->get('entity_type.manager')
->getStorage('file');
file_unmanaged_copy(drupal_get_path('module', 'bamboo_twig_test') . '/files/antistatique.jpg', PublicStream::basePath());
$file = $fileStorage
->create([
'uri' => 'public://antistatique.jpg',
'status' => FILE_STATUS_PERMANENT,
]);
$file
->save();
return $file;
}