$session =
$this->
getSession();
$page =
$session->
getPage();
$assert_session =
$this->
assertSession();
$this->
doTestCreateMediaType($media_type_id, 'file',
$provided_fields);
// Create custom fields for the media type to store metadata attributes.
$fields =
[ 'field_string_file_size' => 'string',
'field_string_mime_type' => 'string',
];
$this->
createMediaTypeFields($fields,
$media_type_id);
// Hide the name field widget to test default name generation.
$this->
hideMediaTypeFieldWidget('name',
$media_type_id);
$this->
drupalGet("admin/structure/media/manage/{
$media_type_id}"
);
$page->
selectFieldOption("field_map[" . File::METADATA_ATTRIBUTE_NAME . "]", 'name'
);
$page->
selectFieldOption("field_map[" . File::METADATA_ATTRIBUTE_SIZE . "]", 'field_string_file_size'
);
$page->
selectFieldOption("field_map[" . File::METADATA_ATTRIBUTE_MIME . "]", 'field_string_mime_type'
);
$page->
pressButton('Save'
);
$test_filename =
$this->
randomMachineName() . '.txt';