Escape example

    $mail_config = $this->config('system.mail');
    $mail_config->set('interface.default', 'test_html_mail_collector');
    $mail_config->save();

    $this->drupalLogin($this->webUser);
    $message['message[0][value]'] = 'This <i>is</i> a more <b>specific</b> <sup>test</sup>, the emails are formatted now.';
    $message = $this->submitPersonalContact($this->contactUser, $message);

    // Assert mail content.     $this->assertMailString('body', 'Hello ' . $this->contactUser->getDisplayName(), 1);
    $this->assertMailString('body', $this->webUser->getDisplayName(), 1);
    $this->assertMailString('body', Html::Escape($message['message[0][value]']), 1);
  }

  /** * Tests access to the personal contact form. */
  public function testPersonalContactAccess() {
    // Test allowed access to admin user's contact form.     $this->drupalLogin($this->webUser);
    $this->drupalGet('user/' . $this->adminUser->id() . '/contact');
    $this->assertSession()->statusCodeEquals(200);
    // Check the page title is properly displayed.
Home | Imprint | This part of the site doesn't use cookies.