4 * Class CRM_Utils_MailTest
7 class CRM_Utils_MailTest
extends CiviUnitTestCase
{
9 public function setUp() {
14 * Test case for add( )
15 * test with empty params.
17 public function testFormatRFC822() {
21 'name' => "Test User",
22 'email' => "foo@bar.com",
23 'result' => "Test User <foo@bar.com>",
26 'name' => '"Test User"',
27 'email' => "foo@bar.com",
28 'result' => "Test User <foo@bar.com>",
31 'name' => "User, Test",
32 'email' => "foo@bar.com",
33 'result' => '"User, Test" <foo@bar.com>',
36 'name' => '"User, Test"',
37 'email' => "foo@bar.com",
38 'result' => '"User, Test" <foo@bar.com>',
41 'name' => '"Test User"',
42 'email' => "foo@bar.com",
43 'result' => '"Test User" <foo@bar.com>',
47 'name' => "User, Test",
48 'email' => "foo@bar.com",
49 'result' => '"User, Test" <foo@bar.com>',
53 foreach ($values as $value) {
54 $result = CRM_Utils_Mail
::formatRFC822Email($value['name'],
56 CRM_Utils_Array
::value('useQuote', $value, FALSE)
58 $this->assertEquals($result, $value['result'], 'Expected encoding does not match');