ParagraphsContactTest.php in Paragraphs 8
File
tests/src/Functional/WidgetLegacy/ParagraphsContactTest.php
View source
<?php
namespace Drupal\Tests\paragraphs\Functional\WidgetLegacy;
use Drupal\contact\Entity\ContactForm;
class ParagraphsContactTest extends ParagraphsTestBase {
public static $modules = array(
'contact',
);
public function testContactForm() {
$this
->loginAsAdmin([
'administer contact forms',
'access site-wide contact form',
]);
$this
->addParagraphsType('paragraphs_contact');
$this
->addParagraphsType('text');
$contact_form = ContactForm::create([
'id' => 'test_contact_form',
]);
$contact_form
->save();
$this
->addParagraphsField($contact_form
->id(), 'paragraphs', 'contact_message', 'entity_reference_paragraphs');
$this
->drupalGet('contact/test_contact_form');
$this
->submitForm([], 'paragraphs_paragraphs_contact_add_more');
$this
->assertSession()
->pageTextContains('paragraphs_contact');
$this
->submitForm([], 'paragraphs_0_remove');
$this
->assertSession()
->pageTextContains('Deleted Paragraph: paragraphs_contact');
}
}