You are here

function simplenews_test_simplenews_mail_result_alter in Simplenews 8.2

Same name and namespace in other branches
  1. 3.x tests/modules/simplenews_test/simplenews_test.module \simplenews_test_simplenews_mail_result_alter()

Implements hook_simplenews_mail_result_alter().

File

tests/modules/simplenews_test/simplenews_test.module, line 31
Hook implementations for the Simplenews Test module.

Code

function simplenews_test_simplenews_mail_result_alter(&$result, array $message) {
  if ($results_alter = \Drupal::state()
    ->get('simplenews.test_result_alter')) {
    $result = array_shift($results_alter);
    \Drupal::state()
      ->set('simplenews.test_result_alter', $results_alter);
    if ($result == -1) {
      throw new AbortSendingException('Testing abort sending');
    }
  }
}