public function ParagraphsBackgroundPluginTest::testNoImageField in Paragraphs Collection 8
Tests the functionality when there are no image fields in a paragraph type.
File
- modules/
paragraphs_collection_demo/ tests/ src/ Functional/ ParagraphsBackgroundPluginTest.php, line 134
Class
- ParagraphsBackgroundPluginTest
- Tests the background plugin.
Namespace
Drupal\Tests\paragraphs_collection_demo\FunctionalCode
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
->drupalPostForm('admin/structure/paragraphs_type/text_test', $edit, t('Save'));
$this
->assertText('The Background plugin cannot be enabled without an image field.');
$this
->assertText('No image field type available. Please add at least one in the Manage fields page.');
}