protected function NumericFormatPluralTest::createFile in Drupal 9
Same name and namespace in other branches
- 8 core/modules/views/tests/src/Functional/Plugin/NumericFormatPluralTest.php \Drupal\Tests\views\Functional\Plugin\NumericFormatPluralTest::createFile()
Creates and saves a test file.
Return value
\Drupal\Core\Entity\EntityInterface A file entity.
1 call to NumericFormatPluralTest::createFile()
- NumericFormatPluralTest::testNumericFormatPlural in core/
modules/ views/ tests/ src/ Functional/ Plugin/ NumericFormatPluralTest.php - Tests plural formatting setting on a numeric views handler.
File
- core/
modules/ views/ tests/ src/ Functional/ Plugin/ NumericFormatPluralTest.php, line 151
Class
- NumericFormatPluralTest
- Tests the creation of numeric fields.
Namespace
Drupal\Tests\views\Functional\PluginCode
protected function createFile() {
// Create a new file entity.
$file = File::create([
'uid' => 1,
'filename' => 'druplicon.txt',
'uri' => 'public://druplicon.txt',
'filemime' => 'text/plain',
'created' => 1,
'changed' => 1,
]);
$file
->setPermanent();
file_put_contents($file
->getFileUri(), 'hello world');
// Save it, inserting a new record.
$file
->save();
return $file;
}