/usr/share/php/tests/Horde_Mail/Horde/Mail/ObjectTest.php is in php-horde-mail 2.1.4-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | <?php
/**
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @license http://www.horde.org/licenses/bsd BSD
* @package Mail
* @subpackage UnitTests
*/
class Horde_Mail_ObjectTest extends PHPUnit_Framework_TestCase
{
public function testWriteAddress()
{
$address = 'Test <test@example.com>';
$parser = new Horde_Mail_Rfc822();
$result = $parser->parseAddressList($address);
$this->assertEquals(
$address,
$result[0]->writeAddress()
);
}
public function testEncoding()
{
$address = 'Fooã <test@example.com>';
$parser = new Horde_Mail_Rfc822();
$result = $parser->parseAddressList($address);
$this->assertEquals(
$address,
$result[0]->writeAddress()
);
$this->assertEquals(
'=?utf-8?b?Rm9vw6M=?= <test@example.com>',
$result[0]->writeAddress(array('encode' => true))
);
$this->assertEquals(
'=?iso-8859-1?b?Rm9v4w==?= <test@example.com>',
$result[0]->writeAddress(array('encode' => 'iso-8859-1'))
);
$email = 'ß <test@example.com>';
$result = $parser->parseAddressList($email);
$this->assertEquals(
'=?utf-8?b?w58=?= <test@example.com>',
$result[0]->writeAddress(array('encode' => true))
);
$email2 = 'ß X <test@example.com>';
$result = $parser->parseAddressList($email2);
$this->assertEquals(
'=?utf-8?b?w58=?= X <test@example.com>',
$result[0]->writeAddress(array('encode' => true))
);
$email3 = '"ß X" <test@example.com>';
$result = $parser->parseAddressList($email3);
$this->assertEquals(
'=?utf-8?b?w58=?= X <test@example.com>',
$result[0]->writeAddress(array('encode' => true))
);
}
public function testAddressConstructor()
{
$address = 'Test <test@example.com>';
$addr_ob = new Horde_Mail_Rfc822_Address($address);
$this->assertEquals(
'Test',
$addr_ob->personal
);
$this->assertEquals(
'test',
$addr_ob->mailbox
);
$this->assertEquals(
'example.com',
$addr_ob->host
);
}
public function testEncodedAddressWithIDNHost()
{
if (!extension_loaded('intl')) {
$this->markTestSkipped('Intl module is not available.');
}
$ob = new Horde_Mail_Rfc822_Address();
$ob->personal = 'Aäb';
$ob->mailbox = 'test';
$ob->host = 'üexample.com';
$this->assertEquals(
'=?utf-8?b?QcOkYg==?= <test@xn--example-m2a.com>',
$ob->encoded
);
}
public function testDecodedAddressWithIDNHost()
{
$ob = new Horde_Mail_Rfc822_Address();
$ob->personal = '=?utf-8?b?QcOkYg==?=';
$ob->mailbox = 'test';
$ob->host = 'xn--example-m2a.com';
$this->assertEquals(
'Aäb <test@üexample.com>',
strval($ob)
);
}
public function testBug4834()
{
// Bug #4834: Wrong encoding of email lists with groups.
$addr = '"John Doe" <john@example.com>, Group: peter@example.com, jane@example.com;';
$parser = new Horde_Mail_Rfc822();
$result = $parser->parseAddressList($addr);
$this->assertEquals(
'John Doe <john@example.com>, Group: peter@example.com, jane@example.com;',
strval($result)
);
}
public function testValid()
{
$ob = new Horde_Mail_Rfc822_Address();
$this->assertFalse($ob->valid);
$ob->mailbox = 'test';
$this->assertTrue($ob->valid);
}
}
|