protected function RabbitHolePageRedirectActionTest::createTestFile in Rabbit Hole 8
Same name and namespace in other branches
- 2.x tests/src/Functional/RabbitHolePageRedirectActionTest.php \Drupal\Tests\rabbit_hole\Functional\RabbitHolePageRedirectActionTest::createTestFile()
Creates test file.
Return value
\Drupal\file\FileInterface Test file object.
1 call to RabbitHolePageRedirectActionTest::createTestFile()
- RabbitHolePageRedirectActionTest::testTokenizedUrlRedirect in tests/
src/ Functional/ RabbitHolePageRedirectActionTest.php - Test URL redirect with token value.
File
- tests/
src/ Functional/ RabbitHolePageRedirectActionTest.php, line 244
Class
- RabbitHolePageRedirectActionTest
- Test the "Page redirect" action.
Namespace
Drupal\Tests\rabbit_hole\FunctionalCode
protected function createTestFile($filename) {
/** @var \Drupal\file\FileInterface $file */
$file = File::create([
'uid' => 1,
'filename' => "{$filename}.txt",
'uri' => "public://{$filename}.txt",
'filemime' => 'text/plain',
'status' => FILE_STATUS_PERMANENT,
]);
file_put_contents($file
->getFileUri(), $filename);
$file
->save();
return $file;
}