You are here

public function MandrillTestCase::testGetSubAccounts in Mandrill 8

Tests getting a list of subaccounts.

File

tests/src/Functional/MandrillTestCase.php, line 78
Contains \Drupal\mandrill\Tests\MandrillTestCase.

Class

MandrillTestCase
Test core Mandrill functionality.

Namespace

Drupal\mandrill\Tests

Code

public function testGetSubAccounts() {
  $mandrillAPI = \Drupal::service('mandrill.test.api');
  $subAccounts = $mandrillAPI
    ->getSubAccounts();
  $this
    ->assertTrue(!empty($subAccounts), 'Tested retrieving sub-accounts.');
  if (!empty($subAccounts) && is_array($subAccounts)) {
    foreach ($subAccounts as $subAccount) {
      $this
        ->assertTrue(!empty($subAccount['name']), 'Tested valid sub-account: ' . $subAccount['name']);
    }
  }
}