-
Notifications
You must be signed in to change notification settings - Fork 127
/
MailboxTest.php
121 lines (103 loc) · 2.63 KB
/
MailboxTest.php
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
<?php
/**
* Copyright 2011-2015 Horde LLC (http://www.horde.org/)
*
* See the enclosed file COPYING for license information (LGPL). If you
* did not receive this file, see http://www.horde.org/licenses/lgpl21.
*
* @category Horde
* @copyright 2011-2015 Horde LLC
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Imap_Client
* @subpackage UnitTests
*/
/**
* Tests for the mailbox object.
*
* @author Michael Slusarz <slusarz@horde.org>
* @category Horde
* @copyright 2011-2015 Horde LLC
* @ignore
* @license http://www.horde.org/licenses/lgpl21 LGPL 2.1
* @package Imap_Client
* @subpackage UnitTests
*/
class Horde_Imap_Client_MailboxTest extends PHPUnit_Framework_TestCase
{
public function testMailboxClone()
{
$ob = new Horde_Imap_Client_Mailbox('Envoyé');
$ob2 = clone $ob;
$this->assertEquals(
'Envoyé',
$ob2->utf8
);
}
public function testMailboxSerialize()
{
$mailbox = unserialize(
serialize(new Horde_Imap_Client_Mailbox('Envoyé'))
);
$this->assertEquals(
'Envoyé',
$mailbox->utf8
);
$this->assertEquals(
'Envoy&AOk-',
$mailbox->utf7imap
);
}
public function testMailboxGet()
{
$a = Horde_Imap_Client_Mailbox::get('B');
$this->assertEquals(
'B',
$a->utf7imap
);
$mailbox = new Horde_Imap_Client_Mailbox('A');
$b = Horde_Imap_Client_Mailbox::get($mailbox);
$this->assertEquals(
$mailbox,
$b
);
}
public function testBug10093()
{
$orig = 'Foo&Bar-2011';
$mailbox = new Horde_Imap_Client_Mailbox($orig);
$this->assertEquals(
'Foo&Bar-2011',
$mailbox->utf8
);
$this->assertEquals(
'Foo&-Bar-2011',
$mailbox->utf7imap
);
}
/**
* @dataProvider listEscapeProvider
*/
public function testListEscape($orig, $expected)
{
$mailbox = new Horde_Imap_Client_Mailbox($orig);
$this->assertEquals(
$expected,
$mailbox->list_escape
);
}
public function listEscapeProvider()
{
return array(
array('***Foo***', '%Foo%'),
array('IN.***Foo**.Bar.Test**', 'IN.%Foo%.Bar.Test%')
);
}
public function testInboxCaseInsensitive()
{
$mailbox = new Horde_Imap_Client_Mailbox('inbox');
$this->assertEquals(
'INBOX',
$mailbox
);
}
}