public function FileFieldSourcesTestBase::uploadFileByRemoteSource in FileField Sources 8
Upload file by 'Remote' source.
Parameters
string $url: File url.
string $filename: File name.
int $delta: Delta in multiple values field.
4 calls to FileFieldSourcesTestBase::uploadFileByRemoteSource()
- EmptyValuesTest::testAllSourcesEnabled in tests/
src/ Functional/ EmptyValuesTest.php - Tests all sources enabled.
- MultipleValuesTest::uploadFiles in tests/
src/ Functional/ MultipleValuesTest.php - Upload files.
- RemoteSourceTest::testFileWithSpecialCharacters in tests/
src/ Functional/ RemoteSourceTest.php - Tests remote source with an special character.
- RemoteSourceTest::testRemoteSourceEnabled in tests/
src/ Functional/ RemoteSourceTest.php - Tests remote source enabled.
File
- tests/
src/ Functional/ FileFieldSourcesTestBase.php, line 378
Class
- FileFieldSourcesTestBase
- Base class for File Field Sources test cases.
Namespace
Drupal\Tests\filefield_sources\FunctionalCode
public function uploadFileByRemoteSource($url = '', $filename = '', $delta = 0) {
$name = $this->fieldName . '[' . $delta . '][filefield_remote][url]';
$edit = [
$name => $url,
];
$this
->drupalPostForm(NULL, $edit, $this->fieldName . '_' . $delta . '_transfer');
if ($filename) {
$this
->assertFileUploaded($filename, $delta);
}
else {
$this
->assertFileNotUploaded($delta);
}
}