class ParagraphsContactTest

Same name in this branch
  1. 8.x-1.x paragraphs/tests/src/Functional/WidgetStable/ParagraphsContactTest.php \Drupal\Tests\paragraphs\Functional\WidgetStable\ParagraphsContactTest
  2. 8.x-1.x paragraphs/tests/src/Functional/WidgetLegacy/ParagraphsContactTest.php \Drupal\Tests\paragraphs\Functional\WidgetLegacy\ParagraphsContactTest

Tests paragraphs with contact forms.

@group paragraphs


Expanded class hierarchy of ParagraphsContactTest


paragraphs/tests/src/Functional/WidgetStable/ParagraphsContactTest.php, line 12


View source
class ParagraphsContactTest extends ParagraphsTestBase {

   * Modules to enable.
   * @var array
  protected static $modules = array(

   * Tests adding paragraphs in contact forms.
  public function testContactForm() {
      'administer contact forms',
      'access site-wide contact form',

    // Add a paragraph type.

    // Create a contact form.
    $contact_form = ContactForm::create([
      'id' => 'test_contact_form',
      'label' => 'Test form',

    // Add a paragraphs field to the contact form.
      ->id(), 'paragraphs', 'contact_message');

    // Add a paragraph to the contact form.
      ->submitForm([], 'paragraphs_paragraphs_contact_add_more');

    // Check that the paragraph is displayed.
      ->submitForm([], 'paragraphs_0_remove');
    $elements = $this
      ->xpath('//table[starts-with(@id, :id)]/tbody', [
      ':id' => 'paragraphs-values',
    $header = $this
      ->xpath('//table[starts-with(@id, :id)]/thead', [
      ':id' => 'paragraphs-values',
      ->assertEquals($elements, []);
      ->assertNotEquals($header, []);



Namesort descending Modifiers Type Description Overrides
ParagraphsContactTest::$modules protected static property Modules to enable. Overrides ParagraphsTestBase::$modules
ParagraphsContactTest::testContactForm public function Tests adding paragraphs in contact forms.
ParagraphsTestBase::$admin_permissions protected property List of permissions used by loginAsAdmin().
ParagraphsTestBase::$admin_user protected property Drupal user object created by loginAsAdmin(). 1
ParagraphsTestBase::$defaultTheme protected property 2
ParagraphsTestBase::loginAsAdmin function Creates an user with admin permissions and log in.
ParagraphsTestBase::removeDefaultParagraphType protected function Removes the default paragraph type. Overrides ParagraphsTestBase::removeDefaultParagraphType
ParagraphsTestBase::setAddMode protected function Sets the Paragraphs widget add mode. Overrides ParagraphsTestBase::setAddMode
ParagraphsTestBase::setAllowedParagraphsTypes protected function Sets the allowed Paragraphs types that can be added.
ParagraphsTestBase::setDefaultParagraphType protected function Sets the default paragraph type.
ParagraphsTestBase::setParagraphsTypeWeight protected function Sets the weight of a given Paragraphs type.
ParagraphsTestBase::setParagraphsWidgetMode protected function Sets the Paragraphs widget display mode.
ParagraphsTestBase::setUp protected function 19
ParagraphsTestBaseTrait::$workflow protected property The workflow entity.
ParagraphsTestBaseTrait::addFieldtoParagraphType protected function Adds a field to a given paragraph type.
ParagraphsTestBaseTrait::addParagraphedContentType protected function Adds a content type with a Paragraphs field.
ParagraphsTestBaseTrait::addParagraphsField protected function Adds a Paragraphs field to a given entity type.
ParagraphsTestBaseTrait::addParagraphsType protected function Adds a Paragraphs type.
ParagraphsTestBaseTrait::addParagraphsTypeIcon protected function Adds an icon to a paragraphs type.
ParagraphsTestBaseTrait::coreVersion protected function Checks the core version.
ParagraphsTestBaseTrait::createEditorialWorkflow protected function Creates a workflow entity.
ParagraphsTestBaseTrait::setParagraphsWidgetSettings protected function Sets some of the settings of a paragraphs field widget.