You are here

public function AmazonSesHandlerTest::testSend in Amazon SES 2.0.x

Tests that the handler successfully sends an email.

@dataProvider messageData

File

tests/src/Kernel/AmazonSesHandlerTest.php, line 45

Class

AmazonSesHandlerTest
Tests the Amazon SES handler service.

Namespace

Drupal\Tests\amazon_ses\Kernel

Code

public function testSend($message) {
  $message_id = $this
    ->randomString();
  $this->prophecy
    ->sendEmail(Argument::type('array'))
    ->willReturn([
    'MessageId' => $message_id,
  ]);
  $client = $this->prophecy
    ->reveal();
  $this->container
    ->set('amazon_ses.client', $client);
  $handler = $this->container
    ->get('amazon_ses.handler');
  $return = $handler
    ->send($message);
  $this
    ->assertEquals($return, $message_id);
}