$field_empty_types_message = 'There are no allowed media types configured for this field. <a href="' .
$field_empty_types_url->
toString() . '">Edit the field settings</a> to select the allowed media types.';
$field_null_types_url =
new Url('entity.field_config.node_field_edit_form',
[ 'field_config' => 'node.basic_page.field_null_types_media',
] +
$route_bundle_params);
$field_null_types_message = 'There are no allowed media types configured for this field. <a href="' .
$field_null_types_url->
toString() . '">Edit the field settings</a> to select the allowed media types.';
// Visit a node create page.
$this->
drupalGet('node/add/basic_page'
);
// Assert a properly configured field still shows a message.
$assert_session->
elementContains('css', '.field--name-field-twin-media',
$field_twin_message);
$assert_session->
elementNotExists('css', '.js-media-library-open-button[name^="field_twin_media"]'
);
// Assert that the message is shown when the target_bundles setting for the
// entity reference field is an empty array.
$assert_session->
elementContains('css', '.field--name-field-empty-types-media',
$field_empty_types_message);
$assert_session->
elementNotExists('css', '.js-media-library-open-button[name^="field_empty_types_media"]'
);
// Assert that the message is shown when the target_bundles setting for the
// entity reference field is null.
$assert_session->
elementContains('css', '.field--name-field-null-types-media',
$field_null_types_message);
$assert_session->
elementNotExists('css', '.js-media-library-open-button[name^="field_null_types_media"]'
);
// Assert the messages are also shown in the default value section of the