'create basic_page content',
'create media',
'view media',
]);
$this->
drupalLogin($user);
$default_message = 'There are no allowed media types configured for this field. Please contact the site administrator.';
$this->
drupalGet('node/add/basic_page'
);
// Assert a properly configured field does not show a message.
$assert_session->
elementTextNotContains('css', '.field--name-field-twin-media', 'There are no allowed media types configured for this field.'
);
$assert_session->
elementExists('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. No types are allowed in this
// case.
$assert_session->
elementTextContains('css', '.field--name-field-empty-types-media',
$default_message);
$assert_session->
elementNotExists('css', '.js-media-library-open-button[name^="field_empty_types_media"]'
);
// Assert that the message is not shown when the target_bundles setting for
// the entity reference field is null. All types are allowed in this case.
$assert_session->
elementTextNotContains('css', '.field--name-field-null-types-media', 'There are no allowed media types configured for this field.'
);
$assert_session->
elementExists('css', '.js-media-library-open-button[name^="field_null_types_media"]'
);