You are here

public function MimeMailFormatHelperTest::providerAddress in Mime Mail 8

Provides test data for testAddress().

Tests addresses provided as text email addresses, e.g. someone@example.com.

File

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

Class

MimeMailFormatHelperTest
Tests that Mime Mail utility functions work properly.

Namespace

Drupal\Tests\mimemail\Kernel

Code

public function providerAddress() {

  // Format of each element is:
  // - address: Email address to test.
  // - result: Expected return value from
  //   MimeMailFormatHelper::mimeMailAddress($address, $simplify = FALSE).
  // - simplified_result: Expected return value from
  //   MimeMailFormatHelper::mimeMailAddress($address, $simplify = TRUE).
  $addresses = [
    'Encoded display-name' => [
      '=?utf-8?Q?Drupal=20Supporters?= <support@association.drupal.org>',
      '=?utf-8?Q?Drupal=20Supporters?= <support@association.drupal.org>',
      'support@association.drupal.org',
    ],
    'Display-name needing quotes' => [
      'Acme Industries, Inc. <no-reply@acme.example.com>',
      '"Acme Industries, Inc." <no-reply@acme.example.com>',
      'no-reply@acme.example.com',
    ],
    'UTF-8 display-name' => [
      '山田太郎 <taro@example.com>',
      '=?UTF-8?B?5bGx55Sw5aSq6YOO?= <taro@example.com>',
      'taro@example.com',
    ],
    'No display-name' => [
      'alpher@example.com',
      'alpher@example.com',
      'alpher@example.com',
    ],
    'No display-name, address between < and >' => [
      '<tr@202830.no-reply.drupal.org>',
      '<tr@202830.no-reply.drupal.org>',
      'tr@202830.no-reply.drupal.org',
    ],
  ];
  return $addresses;
}