public function MandrillTemplateTestCase::testSendTemplatedMessageInvalidTemplate in Mandrill 8
Test sending a templated message using an invalid template.
File
- modules/
mandrill_template/ tests/ src/ Functional/ MandrillTemplateTestCase.php, line 86 - Test class and methods for the Mandrill Template module.
Class
- MandrillTemplateTestCase
- Test Mandrill Template functionality.
Namespace
Drupal\mandrill_template\TestsCode
public function testSendTemplatedMessageInvalidTemplate() {
$to = 'Recipient One <recipient.one@example.com>';
$message = $this
->getMessageTestData();
$message['to'] = $to;
$template_id = 'Invalid Template';
$template_content = array(
'name' => 'Recipient',
);
/* @var $mandrillAPI \Drupal\mandrill\MandrillTestAPI */
$mandrillAPI = \Drupal::service('mandrill.test.api');
$response = $mandrillAPI
->sendTemplate($message, $template_id, $template_content);
$this
->assertNotNull($response, 'Tested response from sending invalid templated message.');
if (isset($response['status'])) {
$this
->assertEqual($response['status'], 'error', 'Tested response status: ' . $response['status'] . ', ' . $response['message']);
}
}