Update to Drupal 8.2.0. For more information, see https://www.drupal.org/project/drupal/releases/8.2.0

This commit is contained in:
Pantheon Automation 2016-10-06 15:16:20 -07:00 committed by Greg Anderson
parent 2f563ab520
commit f1c8716f57
1732 changed files with 52334 additions and 11780 deletions

View file

@ -6,3 +6,5 @@ label: 'Personal contact form'
recipients: { }
reply: ''
weight: 0
message: 'Your message has been sent.'
redirect: ''

View file

@ -22,6 +22,12 @@ contact.form.*:
weight:
type: integer
label: 'Weight'
message:
type: label
label: 'Message displayed to user on submission'
redirect:
type: path
label: 'Redirect path on submission'
contact.settings:
type: config_object

View file

@ -51,7 +51,7 @@ function contact_entity_type_alter(array &$entity_types) {
*/
function contact_entity_extra_field_info() {
$fields = array();
foreach (array_keys(entity_get_bundles('contact_message')) as $bundle) {
foreach (array_keys(\Drupal::service('entity_type.bundle.info')->getBundleInfo('contact_message')) as $bundle) {
$fields['contact_message'][$bundle]['form']['name'] = array(
'label' => t('Sender name'),
'description' => t('Text'),

View file

@ -0,0 +1,30 @@
<?php
/**
* @file
* Post update functions for Contact.
*/
use Drupal\contact\Entity\ContactForm;
/**
* @addtogroup updates-8.1.x-to-8.2.x
* @{
*/
/**
* Initialize 'message' and 'redirect' field values to 'contact_form' entities.
*/
function contact_post_update_add_message_redirect_field_to_contact_form() {
/** @var \Drupal\contact\ContactFormInterface $contact */
foreach (ContactForm::loadMultiple() as $contact) {
$contact
->setMessage('Your message has been sent.')
->setRedirectPath('')
->save();
}
}
/**
* @} End of "addtogroup updates-8.1.x-to-8.2.x".
*/

View file

@ -2,6 +2,7 @@
namespace Drupal\contact;
use Drupal\Component\Utility\Unicode;
use Drupal\Core\DependencyInjection\ContainerInjectionInterface;
use Symfony\Component\DependencyInjection\ContainerInterface;
use Drupal\Core\Entity\EntityForm;
@ -9,6 +10,8 @@ use Drupal\Core\Entity\EntityTypeInterface;
use Drupal\Core\Form\ConfigFormBaseTrait;
use Drupal\Core\Form\FormStateInterface;
use Egulias\EmailValidator\EmailValidator;
use Drupal\Core\Path\PathValidatorInterface;
use Drupal\Core\Render\Element\PathElement;
/**
* Base form for contact form edit forms.
@ -23,14 +26,24 @@ class ContactFormEditForm extends EntityForm implements ContainerInjectionInterf
*/
protected $emailValidator;
/**
* The path validator.
*
* @var \Drupal\Core\Path\PathValidatorInterface
*/
protected $pathValidator;
/**
* Constructs a new ContactFormEditForm.
*
* @param \Egulias\EmailValidator\EmailValidator $email_validator
* The email validator.
* @param \Drupal\Core\Path\PathValidatorInterface $path_validator
* The path validator service.
*/
public function __construct(EmailValidator $email_validator) {
$this->emailValidator = $email_validator;
public function __construct(EmailValidator $email_validator, PathValidatorInterface $path_validator) {
$this->emailValidator = $email_validator;
$this->pathValidator = $path_validator;
}
/**
@ -38,7 +51,8 @@ class ContactFormEditForm extends EntityForm implements ContainerInjectionInterf
*/
public static function create(ContainerInterface $container) {
return new static(
$container->get('email.validator')
$container->get('email.validator'),
$container->get('path.validator')
);
}
@ -82,6 +96,19 @@ class ContactFormEditForm extends EntityForm implements ContainerInjectionInterf
'#description' => $this->t("Example: 'webmaster@example.com' or 'sales@example.com,support@example.com' . To specify multiple recipients, separate each email address with a comma."),
'#required' => TRUE,
);
$form['message'] = array(
'#type' => 'textarea',
'#title' => $this->t('Message'),
'#default_value' => $contact_form->getMessage(),
'#description' => $this->t('The message to display to the user after submission of this form. Leave blank for no message.'),
);
$form['redirect'] = array(
'#type' => 'path',
'#title' => $this->t('Redirect path'),
'#convert_path' => PathElement::CONVERT_NONE,
'#default_value' => $contact_form->getRedirectPath(),
'#description' => $this->t('Path to redirect the user to after submission of this form. For example, type "/about" to redirect to that page. Use a relative path with a slash in front.'),
);
$form['reply'] = array(
'#type' => 'textarea',
'#title' => $this->t('Auto-reply'),
@ -119,6 +146,12 @@ class ContactFormEditForm extends EntityForm implements ContainerInjectionInterf
}
}
$form_state->setValue('recipients', $recipients);
$redirect_url = $form_state->getValue('redirect');
if ($redirect_url && $this->pathValidator->isValid($redirect_url)) {
if (Unicode::substr($redirect_url, 0, 1) !== '/') {
$form_state->setErrorByName('redirect', $this->t('The path should start with /.'));
}
}
}
/**
@ -130,12 +163,13 @@ class ContactFormEditForm extends EntityForm implements ContainerInjectionInterf
$contact_settings = $this->config('contact.settings');
$edit_link = $this->entity->link($this->t('Edit'));
$view_link = $contact_form->link($contact_form->label(), 'canonical');
if ($status == SAVED_UPDATED) {
drupal_set_message($this->t('Contact form %label has been updated.', array('%label' => $contact_form->label())));
drupal_set_message($this->t('Contact form %label has been updated.', array('%label' => $view_link)));
$this->logger('contact')->notice('Contact form %label has been updated.', array('%label' => $contact_form->label(), 'link' => $edit_link));
}
else {
drupal_set_message($this->t('Contact form %label has been added.', array('%label' => $contact_form->label())));
drupal_set_message($this->t('Contact form %label has been added.', array('%label' => $view_link)));
$this->logger('contact')->notice('Contact form %label has been added.', array('%label' => $contact_form->label(), 'link' => $edit_link));
}

View file

@ -9,6 +9,14 @@ use Drupal\Core\Config\Entity\ConfigEntityInterface;
*/
interface ContactFormInterface extends ConfigEntityInterface {
/**
* Returns the message to be displayed to user.
*
* @return string
* A user message.
*/
public function getMessage();
/**
* Returns list of recipient email addresses.
*
@ -17,6 +25,24 @@ interface ContactFormInterface extends ConfigEntityInterface {
*/
public function getRecipients();
/**
* Returns the path for redirect.
*
* @return string
* The redirect path.
*/
public function getRedirectPath();
/**
* Returns the url object for redirect path.
*
* Empty redirect property results a url object of front page.
*
* @return \Drupal\core\Url
* The redirect url object.
*/
public function getRedirectUrl();
/**
* Returns an auto-reply message to send to the message author.
*
@ -33,6 +59,16 @@ interface ContactFormInterface extends ConfigEntityInterface {
*/
public function getWeight();
/**
* Sets the message to be displayed to the user.
*
* @param string $message
* The message to display after form is submitted.
*
* @return $this
*/
public function setMessage($message);
/**
* Sets list of recipient email addresses.
*
@ -43,6 +79,16 @@ interface ContactFormInterface extends ConfigEntityInterface {
*/
public function setRecipients($recipients);
/**
* Sets the redirect path.
*
* @param string $redirect
* The desired path.
*
* @return $this
*/
public function setRedirectPath($redirect);
/**
* Sets an auto-reply message to send to the message author.
*

View file

@ -4,6 +4,7 @@ namespace Drupal\contact\Entity;
use Drupal\Core\Config\Entity\ConfigEntityBundleBase;
use Drupal\contact\ContactFormInterface;
use Drupal\Core\Url;
/**
* Defines the contact form entity.
@ -39,6 +40,8 @@ use Drupal\contact\ContactFormInterface;
* "recipients",
* "reply",
* "weight",
* "message",
* "redirect",
* }
* )
*/
@ -58,6 +61,13 @@ class ContactForm extends ConfigEntityBundleBase implements ContactFormInterface
*/
protected $label;
/**
* The message displayed to user on form submission.
*
* @var string
*/
protected $message;
/**
* List of recipient email addresses.
*
@ -65,6 +75,13 @@ class ContactForm extends ConfigEntityBundleBase implements ContactFormInterface
*/
protected $recipients = array();
/**
* The path to redirect to on form submission.
*
* @var string
*/
protected $redirect;
/**
* An auto-reply message.
*
@ -79,6 +96,21 @@ class ContactForm extends ConfigEntityBundleBase implements ContactFormInterface
*/
protected $weight = 0;
/**
* {@inheritdoc}
*/
public function getMessage() {
return $this->message;
}
/**
* {@inheritdoc}
*/
public function setMessage($message) {
$this->message = $message;
return $this;
}
/**
* {@inheritdoc}
*/
@ -94,6 +126,34 @@ class ContactForm extends ConfigEntityBundleBase implements ContactFormInterface
return $this;
}
/**
* {@inheritdoc}
*/
public function getRedirectPath() {
return $this->redirect;
}
/**
* {@inheritdoc}
*/
public function getRedirectUrl() {
if ($this->redirect) {
$url = Url::fromUserInput($this->redirect);
}
else {
$url = Url::fromRoute('<front>');
}
return $url;
}
/**
* {@inheritdoc}
*/
public function setRedirectPath($redirect) {
$this->redirect = $redirect;
return $this;
}
/**
* {@inheritdoc}
*/

View file

@ -130,24 +130,15 @@ class Message extends ContentEntityBase implements MessageInterface {
* {@inheritdoc}
*/
public static function baseFieldDefinitions(EntityTypeInterface $entity_type) {
$fields['contact_form'] = BaseFieldDefinition::create('entity_reference')
->setLabel(t('Form ID'))
->setDescription(t('The ID of the associated form.'))
->setSetting('target_type', 'contact_form')
->setRequired(TRUE);
/** @var \Drupal\Core\Field\BaseFieldDefinition[] $fields */
$fields = parent::baseFieldDefinitions($entity_type);
$fields['uuid'] = BaseFieldDefinition::create('uuid')
->setLabel(t('UUID'))
->setDescription(t('The message UUID.'))
->setReadOnly(TRUE);
$fields['contact_form']->setLabel(t('Form ID'))
->setDescription(t('The ID of the associated form.'));
$fields['langcode'] = BaseFieldDefinition::create('language')
->setLabel(t('Language'))
->setDescription(t('The message language code.'))
->setDisplayOptions('form', array(
'type' => 'language_select',
'weight' => 2,
));
$fields['uuid']->setDescription(t('The message UUID.'));
$fields['langcode']->setDescription(t('The message language code.'));
$fields['name'] = BaseFieldDefinition::create('string')
->setLabel(t("The sender's name"))

View file

@ -121,9 +121,9 @@ class MessageForm extends ContentEntityForm {
// prevent the impersonation of other users.
else {
$form['name']['#type'] = 'item';
$form['name']['#value'] = $user->getUsername();
$form['name']['#value'] = $user->getDisplayName();
$form['name']['#required'] = FALSE;
$form['name']['#plain_text'] = $user->getUsername();
$form['name']['#plain_text'] = $user->getDisplayName();
$form['mail']['#type'] = 'item';
$form['mail']['#value'] = $user->getEmail();
@ -206,9 +206,12 @@ class MessageForm extends ContentEntityForm {
$message = $this->entity;
$user = $this->currentUser();
$this->mailHandler->sendMailMessages($message, $user);
$contact_form = $message->getContactForm();
$this->flood->register('contact', $this->config('contact.settings')->get('flood.interval'));
drupal_set_message($this->t('Your message has been sent.'));
if ($submission_message = $contact_form->getMessage()) {
drupal_set_message($submission_message);
}
// To avoid false error messages caused by flood control, redirect away from
// the contact form; either to the contacted user account or the front page.
@ -216,7 +219,7 @@ class MessageForm extends ContentEntityForm {
$form_state->setRedirectUrl($message->getPersonalRecipient()->urlInfo());
}
else {
$form_state->setRedirect('<front>');
$form_state->setRedirectUrl($contact_form->getRedirectUrl());
}
// Save the message. In core this is a no-op but should contrib wish to
// implement message storage, this will make the task of swapping in a real

View file

@ -77,12 +77,12 @@ class ContactPersonalTest extends WebTestBase {
$variables = array(
'@site-name' => $this->config('system.site')->get('name'),
'@subject' => $message['subject[0][value]'],
'@recipient-name' => $this->contactUser->getUsername(),
'@recipient-name' => $this->contactUser->getDisplayName(),
);
$subject = PlainTextOutput::renderFromHtml(t('[@site-name] @subject', $variables));
$this->assertEqual($mail['subject'], $subject, 'Subject is in sent message.');
$this->assertTrue(strpos($mail['body'], 'Hello ' . $variables['@recipient-name']) !== FALSE, 'Recipient name is in sent message.');
$this->assertTrue(strpos($mail['body'], $this->webUser->getUsername()) !== FALSE, 'Sender name is in sent message.');
$this->assertTrue(strpos($mail['body'], $this->webUser->getDisplayName()) !== FALSE, 'Sender name is in sent message.');
$this->assertTrue(strpos($mail['body'], $message['message[0][value]']) !== FALSE, 'Message body is in sent message.');
// Check there was no problems raised during sending.
@ -109,7 +109,7 @@ class ContactPersonalTest extends WebTestBase {
$this->drupalGet('user/' . $this->adminUser->id() . '/contact');
$this->assertResponse(200);
// Check the page title is properly displayed.
$this->assertRaw(t('Contact @username', array('@username' => $this->adminUser->getUsername())));
$this->assertRaw(t('Contact @username', array('@username' => $this->adminUser->getDisplayName())));
// Test denied access to admin user's own contact form.
$this->drupalLogout();

View file

@ -5,6 +5,7 @@ namespace Drupal\contact\Tests;
use Drupal\Component\Utility\Unicode;
use Drupal\contact\Entity\ContactForm;
use Drupal\Core\Mail\MailFormatHelper;
use Drupal\Core\Url;
use Drupal\field_ui\Tests\FieldUiTestTrait;
use Drupal\simpletest\WebTestBase;
use Drupal\Core\Entity\EntityTypeInterface;
@ -127,11 +128,19 @@ class ContactSitewideTest extends WebTestBase {
$this->addContactForm($id = Unicode::strtolower($this->randomMachineName($max_length_exceeded)), $label = $this->randomMachineName($max_length_exceeded), implode(',', array($recipients[0])), '', TRUE);
$this->assertText(format_string('Machine-readable name cannot be longer than @max characters but is currently @exceeded characters long.', array('@max' => $max_length, '@exceeded' => $max_length_exceeded)));
$this->addContactForm($id = Unicode::strtolower($this->randomMachineName($max_length)), $label = $this->randomMachineName($max_length), implode(',', array($recipients[0])), '', TRUE);
$this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
$this->assertText(t('Contact form @label has been added.', array('@label' => $label)));
// Verify that the creation message contains a link to a contact form.
$view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'contact/'));
$this->assert(isset($view_link), 'The message area contains a link to a contact form.');
// Create first valid form.
$this->addContactForm($id = Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0])), '', TRUE);
$this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
$this->assertText(t('Contact form @label has been added.', array('@label' => $label)));
// Verify that the creation message contains a link to a contact form.
$view_link = $this->xpath('//div[@class="messages"]//a[contains(@href, :href)]', array(':href' => 'contact/'));
$this->assert(isset($view_link), 'The message area contains a link to a contact form.');
// Check that the form was created in site default language.
$langcode = $this->config('contact.form.' . $id)->get('langcode');
@ -146,13 +155,13 @@ class ContactSitewideTest extends WebTestBase {
$this->assertEscaped($recipients[0]);
// Test update contact form.
$this->updateContactForm($id, $label = $this->randomMachineName(16), $recipients_str = implode(',', array($recipients[0], $recipients[1])), $reply = $this->randomMachineName(30), FALSE);
$this->updateContactForm($id, $label = $this->randomMachineName(16), $recipients_str = implode(',', array($recipients[0], $recipients[1])), $reply = $this->randomMachineName(30), FALSE, 'Your message has been sent.', '/user');
$config = $this->config('contact.form.' . $id)->get();
$this->assertEqual($config['label'], $label);
$this->assertEqual($config['recipients'], array($recipients[0], $recipients[1]));
$this->assertEqual($config['reply'], $reply);
$this->assertNotEqual($id, $this->config('contact.settings')->get('default_form'));
$this->assertRaw(t('Contact form %label has been updated.', array('%label' => $label)));
$this->assertText(t('Contact form @label has been updated.', array('@label' => $label)));
// Ensure the label is displayed on the contact page for this form.
$this->drupalGet('contact/' . $id);
$this->assertText($label);
@ -170,14 +179,14 @@ class ContactSitewideTest extends WebTestBase {
// Add more forms.
$this->addContactForm(Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0], $recipients[1])), '', FALSE);
$this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
$this->assertText(t('Contact form @label has been added.', array('@label' => $label)));
$this->addContactForm($name = Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($recipients[0], $recipients[1], $recipients[2])), '', FALSE);
$this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
$this->assertText(t('Contact form @label has been added.', array('@label' => $label)));
// Try adding a form that already exists.
$this->addContactForm($name, $label, '', '', FALSE);
$this->assertNoRaw(t('Contact form %label has been added.', array('%label' => $label)));
$this->assertNoText(t('Contact form @label has been added.', array('@label' => $label)));
$this->assertRaw(t('The machine-readable name is already in use. It must be unique.'));
$this->drupalLogout();
@ -290,6 +299,46 @@ class ContactSitewideTest extends WebTestBase {
$this->assertEqual($mail['subject'], t('[@label] @subject', array('@label' => $label, '@subject' => $edit['subject[0][value]'])));
$this->assertTrue(strpos($mail['body'], $field_label));
$this->assertTrue(strpos($mail['body'], $edit[$field_name . '[0][value]']));
// Test messages and redirect.
/** @var \Drupal\contact\ContactFormInterface $form */
$form = ContactForm::load($contact_form);
$form->setMessage('Thanks for your submission.');
$form->setRedirectPath('/user/' . $admin_user->id());
$form->save();
// Check that the field is displayed.
$this->drupalGet('contact/' . $contact_form);
// Submit the contact form and verify the content.
$edit = array(
'subject[0][value]' => $this->randomMachineName(),
'message[0][value]' => $this->randomMachineName(),
$field_name . '[0][value]' => $this->randomMachineName(),
);
$this->drupalPostForm(NULL, $edit, t('Send message'));
$this->assertText('Thanks for your submission.');
$this->assertUrl('user/' . $admin_user->id());
// Test Empty message.
/** @var \Drupal\contact\ContactFormInterface $form */
$form = ContactForm::load($contact_form);
$form->setMessage('');
$form->setRedirectPath('/user/' . $admin_user->id());
$form->save();
$this->drupalGet('admin/structure/contact/manage/' . $contact_form);
// Check that the field is displayed.
$this->drupalGet('contact/' . $contact_form);
// Submit the contact form and verify the content.
$edit = array(
'subject[0][value]' => $this->randomMachineName(),
'message[0][value]' => $this->randomMachineName(),
$field_name . '[0][value]' => $this->randomMachineName(),
);
$this->drupalPostForm(NULL, $edit, t('Send message'));
$result = $this->xpath('//div[@role=:role]', array(':role' => 'contentinfo'));
$this->assertEqual(count($result), 0, 'Messages not found.');
$this->assertUrl('user/' . $admin_user->id());
}
/**
@ -351,13 +400,17 @@ class ContactSitewideTest extends WebTestBase {
* form.
* @param bool $selected
* A Boolean indicating whether the form should be selected by default.
* @param string $message
* The message that will be displayed to a user upon completing the contact
* form.
* @param array $third_party_settings
* Array of third party settings to be added to the posted form data.
*/
function addContactForm($id, $label, $recipients, $reply, $selected, $third_party_settings = []) {
function addContactForm($id, $label, $recipients, $reply, $selected, $message = 'Your message has been sent.', $third_party_settings = []) {
$edit = array();
$edit['label'] = $label;
$edit['id'] = $id;
$edit['message'] = $message;
$edit['recipients'] = $recipients;
$edit['reply'] = $reply;
$edit['selected'] = ($selected ? TRUE : FALSE);
@ -379,13 +432,20 @@ class ContactSitewideTest extends WebTestBase {
* form.
* @param bool $selected
* A Boolean indicating whether the form should be selected by default.
* @param string $message
* The message that will be displayed to a user upon completing the contact
* form.
* @param string $redirect
* The path where user will be redirect after this form has been submitted..
*/
function updateContactForm($id, $label, $recipients, $reply, $selected) {
function updateContactForm($id, $label, $recipients, $reply, $selected, $message = 'Your message has been sent.', $redirect = '/') {
$edit = array();
$edit['label'] = $label;
$edit['recipients'] = $recipients;
$edit['reply'] = $reply;
$edit['selected'] = ($selected ? TRUE : FALSE);
$edit['message'] = $message;
$edit['redirect'] = $redirect;
$this->drupalPostForm("admin/structure/contact/manage/$id", $edit, t('Save'));
}

View file

@ -47,10 +47,10 @@ class ContactStorageTest extends ContactSitewideTest {
$this->drupalLogin($admin_user);
// Create first valid contact form.
$mail = 'simpletest@example.com';
$this->addContactForm($id = Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($mail)), '', TRUE, [
$this->addContactForm($id = Unicode::strtolower($this->randomMachineName(16)), $label = $this->randomMachineName(16), implode(',', array($mail)), '', TRUE, 'Your message has been sent.', [
'send_a_pony' => 1,
]);
$this->assertRaw(t('Contact form %label has been added.', array('%label' => $label)));
$this->assertText(t('Contact form @label has been added.', array('@label' => $label)));
// Ensure that anonymous can submit site-wide contact form.
user_role_grant_permissions(RoleInterface::ANONYMOUS_ID, array('access site-wide contact form'));

View file

@ -0,0 +1,53 @@
<?php
namespace Drupal\contact\Tests\Update;
use Drupal\system\Tests\Update\UpdatePathTestBase;
/**
* Tests contact update path.
*
* @group contact
*/
class ContactUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
];
}
/**
* Tests contact_form updates.
*
* @see contact_post_update_add_message_redirect_field_to_contact_form()
*/
public function testPostUpdateContactFormFields() {
// Check that contact_form does not have fields redirect and message.
$config_factory = \Drupal::configFactory();
// Check that contact_form entities are more than zero.
$contact_forms = $config_factory->listAll('contact.form.');
$this->assertTrue(count($contact_forms), 'There are contact forms to update.');
foreach ($contact_forms as $contact_config_name) {
$contact_form_data = $config_factory->get($contact_config_name)->get();
$this->assertFalse(isset($contact_form_data['message']), 'Prior to running the update the "message" key does not exist.');
$this->assertFalse(isset($contact_form_data['redirect']), 'Prior to running the update the "redirect" key does not exist.');
}
// Run updates.
$this->runUpdates();
// Check that the contact_form entities have been updated.
foreach ($contact_forms as $contact_config_name) {
$contact_form_data = $config_factory->get($contact_config_name)->get();
$this->assertTrue(isset($contact_form_data['message']), 'After running the update the "message" key exists.');
$this->assertEqual('Your message has been sent.', $contact_form_data['message']);
$this->assertTrue(isset($contact_form_data['redirect']), 'After running the update the "redirect" key exists.');
$this->assertEqual('', $contact_form_data['redirect']);
}
}
}

View file

@ -23,11 +23,11 @@ db_insert('contact')->fields(array(
'weight',
'selected'
))
->values(array(
->values(array(
'category' => 'Upgrade test',
'recipients' => 'test1@example.com,test2@example.com',
'reply' => 'Test reply',
'weight' => 1,
'selected' => 1,
))
->execute();
->execute();

View file

@ -5,3 +5,5 @@ reply: ''
weight: 0
status: true
langcode: en
message: 'Your message has been sent.'
redirect: ''

View file

@ -111,7 +111,7 @@ display:
entity_type: user
filters:
status:
value: true
value: '1'
table: users_field_data
field: status
id: status

View file

@ -299,7 +299,7 @@ class MailHandlerTest extends UnitTestCase {
->method('getEmail')
->willReturn($mail_address);
$sender->expects($this->any())
->method('getUsername')
->method('getDisplayName')
->willReturn('user');
// User ID 1 has special implications, use 3 instead.
$sender->expects($this->any())
@ -369,7 +369,7 @@ class MailHandlerTest extends UnitTestCase {
->method('getEmail')
->willReturn('user2@drupal.org');
$recipient->expects($this->once())
->method('getUsername')
->method('getDisplayName')
->willReturn('user2');
$recipient->expects($this->once())
->method('getPreferredLangcode')