You are here

public function MandrillActivityTestCase::testGetActivity in Mandrill 8

Tests getting an array of message activity for a given email address.

File

modules/mandrill_activity/tests/src/Functional/MandrillActivityTestCase.php, line 41
Test class and methods for the Mandrill Activity module.

Class

MandrillActivityTestCase
Test Mandrill Activity functionality.

Namespace

Drupal\mandrill_activity\Tests

Code

public function testGetActivity() {
  $email = 'recipient@example.com';

  /* @var $mandrillAPI \Drupal\mandrill\MandrillTestAPI */
  $mandrillAPI = \Drupal::service('mandrill.test.api');
  $activity = $mandrillAPI
    ->getMessages($email);
  $this
    ->assertTrue(!empty($activity), 'Tested retrieving activity.');
  if (!empty($activity) && is_array($activity)) {
    foreach ($activity as $message) {
      $this
        ->assertEqual($message['email'], $email, 'Tested valid message: ' . $message['subject']);
    }
  }
}