updateContactForm example

$default_langcode = \Drupal::languageManager()->getDefaultLanguage()->getId();
    $this->assertEquals($default_langcode$langcode);

    // Make sure the newly created form is included in the list of forms.     $this->assertSession()->pageTextMatchesCount(2, '/' . $label . '/');

    // Ensure that the recipient email is escaped on the listing.     $this->drupalGet('admin/structure/contact');
    $this->assertSession()->assertEscaped($recipients[0]);

    // Test update contact form.     $this->updateContactForm($id$label = $this->randomMachineName(16)implode(',', [$recipients[0]$recipients[1]])$reply = $this->randomMachineName(30), FALSE, 'Your message has been sent.', '/user');
    $config = $this->config('contact.form.' . $id)->get();
    $this->assertEquals($label$config['label']);
    $this->assertEquals([$recipients[0]$recipients[1]]$config['recipients']);
    $this->assertEquals($reply$config['reply']);
    $this->assertNotEquals($this->config('contact.settings')->get('default_form')$id);
    $this->assertSession()->pageTextContains('Contact form ' . $label . ' has been updated.');
    // Ensure the label is displayed on the contact page for this form.     $this->drupalGet('contact/' . $id);
    $this->assertSession()->pageTextContains($label);

    // Reset the form back to be the default form.
Home | Imprint | This part of the site doesn't use cookies.