protected function FileEntityTestBase::setUpFiles in File Entity (fieldable files) 8.2
Set up some sample text and image files.
6 calls to FileEntityTestBase::setUpFiles()
- FileEntityAccessTest::setUp in tests/
src/ Functional/ FileEntityAccessTest.php - FileEntityAdminTest::testFileOverviewOperations in tests/
src/ Functional/ FileEntityAdminTest.php - Tests single and bulk operations on the file overview.
- FileEntityReplaceTest::setUp in tests/
src/ Functional/ FileEntityReplaceTest.php - FileEntityTokenTest::setUp in tests/
src/ Functional/ FileEntityTokenTest.php - FileEntityTypeTest::setUp in tests/
src/ Functional/ FileEntityTypeTest.php
File
- tests/
src/ Functional/ FileEntityTestBase.php, line 53
Class
- FileEntityTestBase
- Base class for file entity tests.
Namespace
Drupal\Tests\file_entity\FunctionalCode
protected function setUpFiles($defaults = array()) {
// Populate defaults array.
$defaults += array(
'uid' => 1,
'status' => FILE_STATUS_PERMANENT,
);
$types = array(
'text',
'image',
);
foreach ($types as $type) {
foreach ($this
->getTestFiles($type) as $file) {
foreach ($defaults as $key => $value) {
$file->{$key} = $value;
}
$file = File::create((array) $file);
$file
->save();
$this->files[$type][] = $file;
}
}
}