function NumericFormatPluralTest::createFile
Same name in other branches
- 8.9.x core/modules/views/tests/src/Functional/Plugin/NumericFormatPluralTest.php \Drupal\Tests\views\Functional\Plugin\NumericFormatPluralTest::createFile()
- 10 core/modules/views/tests/src/Functional/Plugin/NumericFormatPluralTest.php \Drupal\Tests\views\Functional\Plugin\NumericFormatPluralTest::createFile()
- 11.x 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 154
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.