public function MimeMailFormatHelperTest::providerAssociativeAddressArray in Mime Mail 8
Provides test data for testAddress().
Tests addresses provided as associative arrays containing keys:
- mail: A text email address, as above.
- (optional) name: A text name to accompany the email address, e.g. 'John Doe'.
File
- tests/
src/ Kernel/ MimeMailFormatHelperTest.php, line 190
Class
- MimeMailFormatHelperTest
- Tests that Mime Mail utility functions work properly.
Namespace
Drupal\Tests\mimemail\KernelCode
public function providerAssociativeAddressArray() {
// Format of each element is:
// - address: Associative array of addresses, with 'mail' and 'name' keys.
// - 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 in array' => [
[
'name' => '=?utf-8?Q?Drupal=20Supporters?=',
'mail' => 'support@association.drupal.org',
],
'=?utf-8?Q?Drupal=20Supporters?= <support@association.drupal.org>',
'support@association.drupal.org',
],
'Display-name needing quotes in array' => [
[
'name' => 'Acme Industries, Inc.',
'mail' => 'no-reply@acme.example.com',
],
'"Acme Industries, Inc." <no-reply@acme.example.com>',
'no-reply@acme.example.com',
],
'UTF-8 display-name in array' => [
[
'name' => '山田太郎',
'mail' => 'taro@example.com',
],
'=?UTF-8?B?5bGx55Sw5aSq6YOO?= <taro@example.com>',
'taro@example.com',
],
'No display-name' => [
[
'name' => '',
'mail' => 'gamow@example.com',
],
'gamow@example.com',
'gamow@example.com',
],
];
return $addresses;
}