You are here

public function MimeMailFormatHelperTest::providerArrayOfAddresses in Mime Mail 8

Provides test data for testAddress().

Tests addresses provided as an array of text email addresses.

File

tests/src/Kernel/MimeMailFormatHelperTest.php, line 146

Class

MimeMailFormatHelperTest
Tests that Mime Mail utility functions work properly.

Namespace

Drupal\Tests\mimemail\Kernel

Code

public function providerArrayOfAddresses() {

  // Format of each element is:
  // - address: Array of email addresses to test.
  // - result: Expected return value from
  //   MimeMailFormatHelper::mimeMailAddress($address, $simplify = FALSE).
  // - simplified_result: Expected return value from
  //   MimeMailFormatHelper::mimeMailAddress($address, $simplify = TRUE).
  $addresses = [
    'Array of address strings' => [
      [
        '=?utf-8?Q?Drupal=20Supporters?= <support@association.drupal.org>',
        'Acme Industries, Inc. <no-reply@acme.example.com>',
        '山田太郎 <taro@example.com>',
        'bethe@example.com',
        '<subscriber@example.com>',
      ],
      [
        '=?utf-8?Q?Drupal=20Supporters?= <support@association.drupal.org>',
        '"Acme Industries, Inc." <no-reply@acme.example.com>',
        '=?UTF-8?B?5bGx55Sw5aSq6YOO?= <taro@example.com>',
        'bethe@example.com',
        '<subscriber@example.com>',
      ],
      [
        'support@association.drupal.org',
        'no-reply@acme.example.com',
        'taro@example.com',
        'bethe@example.com',
        'subscriber@example.com',
      ],
    ],
  ];
  return $addresses;
}