fields[
$field_name][type]" =>
$formatter,
"fields[
$field_name][region]" => 'content',
];
} $this->
drupalGet("admin/structure/types/manage/{
$type_name}/display"
);
$this->
submitForm($edit, 'Save'
);
$this->
drupalGet('node/' .
$node->
id());
// Verify that the field label is hidden when no file is attached.
$this->
assertSession()->
pageTextNotContains($field_name);
} $this->
generateFile('escaped-&-text', 64, 10, 'text'
);
$test_file = File::
create([ 'uri' => 'public://escaped-&-text.txt',
'name' => 'escaped-&-text',
'filesize' =>
filesize('public://escaped-&-text.txt'
),
]);
// Create a new node with the uploaded file.
$nid =
$this->
uploadNodeFile($test_file,
$field_name,
$type_name);
// Check that the default formatter is displaying with the file name.
$node_storage =
$this->container->
get('entity_type.manager'
)->
getStorage('node'
);