public function MimeMailFormatHelperTest::testAddress in Mime Mail 8
Tests formatting an address string.
@dataProvider providerAddress @dataProvider providerArrayOfAddresses @dataProvider providerAssociativeAddressArray @covers ::mimeMailAddress
Parameters
string|array|\Drupal\user\UserInterface $address: MimeMailFormatHelper::mimeMailAddress() accepts addresses in one of four different formats:
- A text email address, e.g. someone@example.com.
- An array where the values are each a text email address.
- An associative array to represent one email address, containing keys:
- mail: A text email address, as above.
- (optional) name: A text name to accompany the email address, e.g. 'John Doe'.
- A fully loaded object implementing \Drupal\user\UserInterface.
string $result: Email address after formatting.
string $simplified_result: Simplified email address after formatting.
File
- tests/
src/ Kernel/ MimeMailFormatHelperTest.php, line 88
Class
- MimeMailFormatHelperTest
- Tests that Mime Mail utility functions work properly.
Namespace
Drupal\Tests\mimemail\KernelCode
public function testAddress($address, $result, $simplified_result) {
// Test not simplified.
$formatted = MimeMailFormatHelper::mimeMailAddress($address, $simplify = FALSE);
$this
->assertSame($result, $formatted);
// Test simplified.
$formatted = MimeMailFormatHelper::mimeMailAddress($address, $simplify = TRUE);
$this
->assertSame($simplified_result, $formatted);
}