public function MandrillTemplateTestCase::testGetTemplates in Mandrill 8
Tests getting a list of templates for a given label.
File
- modules/
mandrill_template/ tests/ src/ Functional/ MandrillTemplateTestCase.php, line 41 - Test class and methods for the Mandrill Template module.
Class
- MandrillTemplateTestCase
- Test Mandrill Template functionality.
Namespace
Drupal\mandrill_template\TestsCode
public function testGetTemplates() {
/* @var $mandrillAPI \Drupal\mandrill\MandrillTestAPI */
$mandrillAPI = \Drupal::service('mandrill.test.api');
$templates = $mandrillAPI
->getTemplates();
$this
->assertTrue(!empty($templates), 'Tested retrieving templates.');
if (!empty($templates) && is_array($templates)) {
foreach ($templates as $template) {
$this
->assertTrue(!empty($template['name']), 'Tested valid template: ' . $template['name']);
}
}
}