public function FileTestBase::dataProviderPrepareValue in Feeds 8.3
Data provider for testPrepareValue().
1 call to FileTestBase::dataProviderPrepareValue()
- FileTest::dataProviderPrepareValue in tests/
src/ Kernel/ Feeds/ Target/ FileTest.php - Data provider for testPrepareValue().
1 method overrides FileTestBase::dataProviderPrepareValue()
- FileTest::dataProviderPrepareValue in tests/
src/ Kernel/ Feeds/ Target/ FileTest.php - Data provider for testPrepareValue().
File
- tests/
src/ Kernel/ Feeds/ Target/ FileTestBase.php, line 195
Class
- FileTestBase
- Base class for file field tests.
Namespace
Drupal\Tests\feeds\Kernel\Feeds\TargetCode
public function dataProviderPrepareValue() {
$return = [
// Empty file target value.
'empty-file' => [
'expected' => [],
'values' => [
'target_id' => '',
],
'expected_exception' => EmptyFeedException::class,
'expected_exception_message' => 'The given file url is empty.',
],
// Importing a file url that exists.
'file-success' => [
'expected' => [
'target_id' => 1,
],
'values' => [
'target_id' => '[url]/assets/attersee.jpeg',
],
],
// Importing a file with uppercase extension.
'file-uppercase' => [
'expected' => [
'target_id' => 1,
],
'values' => [
'target_id' => '[url]/assets/attersee.JPG',
],
],
// Importing a file url that does *not* exist.
'file-not-found' => [
'expected' => [],
'values' => [
'target_id' => '[url]/assets/not-found.jpg',
],
'expected_exception' => TargetValidationException::class,
'expected_exception_message' => 'Download of <em class="placeholder">[url]/assets/not-found.jpg</em> failed with code 404.',
],
// Importing a file with invalid extension.
'invalid-extension' => [
'expected' => [],
'values' => [
'target_id' => '[url]/file.foo',
],
'expected_exception' => TargetValidationException::class,
'expected_exception_message' => 'The file, <em class="placeholder">[url]/file.foo</em>, failed to save because the extension, <em class="placeholder">foo</em>, is invalid.',
],
];
return $return;
}