You are here

function simplenews_test_simplenews_mail_result_alter in Simplenews 3.x

Same name and namespace in other branches
  1. 8.2 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 30
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');
    }
  }
}