You are here

protected function MailHandlerTest::getMockContactForm in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 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 402
Contains \Drupal\Tests\contact\Unit\MailHandlerTest.

Class

MailHandlerTest
@coversDefaultClass \Drupal\contact\MailHandler @group contact

Namespace

Drupal\Tests\contact\Unit

Code

protected function getMockContactForm($recipients, $auto_reply) {
  $contact_form = $this
    ->getMock('\\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;
}