Tests the functionality when there are no image fields in a paragraph type.
public function testNoImageField() {
// Create an article with paragraphs field.
$this
->addParagraphedContentType('article', 'paragraphs');
$this
->loginAsAdmin();
// Add a text paragraphs type without any field.
$this
->addParagraphsType('text_test');
$edit = [
'behavior_plugins[background][enabled]' => TRUE,
];
// Assert that the error messages are displayed.
$this
->drupalGet('admin/structure/paragraphs_type/text_test');
$this
->submitForm($edit, t('Save'));
$this
->assertSession()
->responseContains('The Background plugin cannot be enabled without an image field.');
$this
->assertSession()
->pageTextContains('No image field type available. Please add at least one in the Manage fields page.');
}