// Change the format to 'RSS enclosure'.
$this->
drupalGet("admin/structure/types/manage/
$type_name/display/rss"
);
$edit =
[ "fields[
$field_name][type]" => 'file_rss_enclosure',
"fields[
$field_name][region]" => 'content',
];
$this->
submitForm($edit, 'Save'
);
// Create a new node with a file field set. Promote to frontpage
// needs to be set so this node will appear in the RSS feed.
$node =
$this->
drupalCreateNode(['type' =>
$type_name, 'promote' => 1
]);
$test_file =
$this->
getTestFile('text'
);
// Create a new node with the uploaded file.
$nid =
$this->
uploadNodeFile($test_file,
$field_name,
$node->
id());
// Get the uploaded file from the node.
$node_storage->
resetCache([$nid]);
$node =
$node_storage->
load($nid);
$node_file = File::
load($node->
{$field_name}->target_id
);
// Check that the RSS enclosure appears in the RSS feed.
$this->
drupalGet('rss.xml'
);