protected function MailHandlerTest::getMockContactForm in Drupal 9
Same name and namespace in other branches
- 8 core/modules/contact/tests/src/Unit/MailHandlerTest.php \Drupal\Tests\contact\Unit\MailHandlerTest::getMockContactForm()
Builds a mock message on given scenario.
Parameters
array $recipients: An array of recipient email addresses.
string $auto_reply: An auto-reply message to send to the message author.
Return value
\Drupal\contact\ContactFormInterface|\PHPUnit\Framework\MockObject\MockObject Mock message for testing.
2 calls to MailHandlerTest::getMockContactForm()
- MailHandlerTest::getAnonymousMockMessage in core/
modules/ contact/ tests/ src/ Unit/ MailHandlerTest.php - Builds a mock message from anonymous user.
- MailHandlerTest::getAuthenticatedMockMessage in core/
modules/ contact/ tests/ src/ Unit/ MailHandlerTest.php - Builds a mock message from authenticated user.
File
- core/
modules/ contact/ tests/ src/ Unit/ MailHandlerTest.php, line 398
Class
- MailHandlerTest
- @coversDefaultClass \Drupal\contact\MailHandler @group contact
Namespace
Drupal\Tests\contact\UnitCode
protected function getMockContactForm($recipients, $auto_reply) {
$contact_form = $this
->createMock('\\Drupal\\contact\\ContactFormInterface');
$contact_form
->expects($this
->once())
->method('getRecipients')
->willReturn($recipients);
$contact_form
->expects($this
->once())
->method('getReply')
->willReturn($auto_reply);
return $contact_form;
}