@@ -64,149 +64,133 @@ public function testGetFolderType()
64
64
$ this ->createListMailFolder ("Entwürfe " , "/ " )
65
65
));
66
66
67
+ // +--------------------
68
+ // | INBOX
69
+ // +-------------------
67
70
$ this ->assertSame (
68
- $ mapper ->getFolderType (
69
- $ this ->createListMailFolder ("SomeRandomFolder/Draft " , "/ " )
70
- ),
71
- MailFolder::TYPE_FOLDER
72
- );
73
- $ this ->assertSame (
74
- $ mapper ->getFolderType (
75
- $ this ->createListMailFolder ("SomeRandomFolder/Draft/Test " , "/ " )
76
- ),
77
- MailFolder::TYPE_FOLDER
71
+ MailFolder::TYPE_INBOX ,
72
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("INBOX " , ". " )),
78
73
);
79
74
$ this ->assertSame (
80
- $ mapper ->getFolderType (
81
- $ this ->createListMailFolder ("SomeRandom " , ". " )
82
- ),
83
- MailFolder::TYPE_FOLDER
75
+ MailFolder::TYPE_INBOX ,
76
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("POSTEINGANG " , ". " )),
84
77
);
78
+
79
+ // DRAFTS
85
80
$ this ->assertSame (
86
- $ mapper ->getFolderType (
87
- $ this ->createListMailFolder ("INBOX " , ". " )
88
- ),
89
- MailFolder::TYPE_INBOX
81
+ MailFolder::TYPE_DRAFT ,
82
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("INBOX.Drafts " , ". " ))
83
+
90
84
);
91
85
$ this ->assertSame (
92
- $ mapper ->getFolderType (
93
- $ this ->createListMailFolder ("INBOX/Somefolder/Deep/Drafts " , "/ " )
94
- ),
95
- MailFolder::TYPE_FOLDER
86
+ MailFolder::TYPE_DRAFT ,
87
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("INBOX-DRAFTS " , "- " ))
96
88
);
97
89
$ this ->assertSame (
98
- $ mapper ->getFolderType (
99
- $ this ->createListMailFolder ("INBOX.Drafts " , ". " )
100
- ),
101
- MailFolder::TYPE_DRAFT
90
+ MailFolder::TYPE_DRAFT ,
91
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("Draft " , "- " ))
102
92
);
103
93
$ this ->assertSame (
104
- $ mapper ->getFolderType (
105
- $ this ->createListMailFolder ("INBOX.Trash.Deep.Deeper.Folder " , ". " )
106
- ),
107
- MailFolder::TYPE_FOLDER
94
+ MailFolder::TYPE_DRAFT ,
95
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("Entwurf " , "/ " ))
108
96
);
109
97
98
+
99
+ // TRASH
110
100
$ this ->assertSame (
111
- $ mapper ->getFolderType (
112
- $ this ->createListMailFolder ("Junk/Draft " , "/ " )
113
- ),
114
- MailFolder::TYPE_FOLDER
115
- );
116
- $ this ->assertSame (
117
- $ mapper ->getFolderType (
118
- $ this ->createListMailFolder ("TRASH.Draft.folder " , ". " )
119
- ),
120
- MailFolder::TYPE_FOLDER
121
- );
122
- $ this ->assertSame (
123
- $ mapper ->getFolderType (
124
- $ this ->createListMailFolder ("TRASH " , "/ " )
125
- ),
101
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("TRASH " , "/ " )),
126
102
MailFolder::TYPE_TRASH
127
103
);
128
104
129
105
$ this ->assertSame (
130
- $ mapper ->getFolderType (
131
- $ this ->createListMailFolder ("INBOX:TRASH " , ": " )
132
- ),
106
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("INBOX:TRASH " , ": " )),
133
107
MailFolder::TYPE_TRASH
134
108
);
135
- $ this ->assertSame (
136
- $ mapper ->getFolderType (
137
- $ this ->createListMailFolder ("INBOX-DRAFTS " , "- " )
138
- ),
139
- MailFolder::TYPE_DRAFT
140
- );
141
109
142
110
$ this ->assertSame (
143
- $ mapper ->getFolderType (
144
- $ this ->createListMailFolder ("DELETED " , ": " )
145
- ),
111
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("DELETED " , ": " )),
146
112
MailFolder::TYPE_TRASH
147
113
);
148
114
149
115
$ this ->assertSame (
150
- MailFolder::TYPE_DRAFT ,
151
- $ mapper ->getFolderType (
152
- $ this ->createListMailFolder ("Draft " , "- " )
153
- )
116
+ MailFolder::TYPE_TRASH ,
117
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("DELETED MESSAGES " , ". " ))
154
118
);
155
119
156
120
$ this ->assertSame (
157
- MailFolder::TYPE_JUNK ,
158
- $ mapper ->getFolderType (
159
- $ this ->createListMailFolder ("Inbox.SPAMVerDacht " , ". " )
160
- )
121
+ MailFolder::TYPE_TRASH ,
122
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("GELÖSCHT " , ". " ))
161
123
);
162
-
163
124
$ this ->assertSame (
164
125
MailFolder::TYPE_TRASH ,
165
- $ mapper ->getFolderType (
166
- $ this ->createListMailFolder ("DELETED MESSAGES " , ". " )
167
- )
126
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("PapIerKorb " , ". " ))
168
127
);
169
128
129
+ // JUNK
170
130
$ this ->assertSame (
171
- MailFolder::TYPE_SENT ,
131
+ MailFolder::TYPE_JUNK ,
172
132
$ mapper ->getFolderType (
173
- $ this ->createListMailFolder ("SENT MESSAGES " , ". " )
133
+ $ this ->createListMailFolder ("SPAMVerDacht " , ". " )
174
134
)
175
135
);
176
136
177
-
178
137
$ this ->assertSame (
179
138
MailFolder::TYPE_JUNK ,
180
- $ mapper ->getFolderType (
181
- $ this ->createListMailFolder ("SPAMVerDacht " , ". " )
182
- )
139
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("Inbox.SPAMVerDacht " , ". " ))
183
140
);
184
-
185
141
$ this ->assertSame (
186
- MailFolder::TYPE_TRASH ,
187
- $ mapper ->getFolderType (
188
- $ this ->createListMailFolder ("GELÖSCHT " , ". " )
189
- )
142
+ MailFolder::TYPE_JUNK ,
143
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("Spam " , "- " ))
190
144
);
191
145
146
+ // SENT
192
147
$ this ->assertSame (
193
148
MailFolder::TYPE_SENT ,
194
- $ mapper ->getFolderType (
195
- $ this ->createListMailFolder ("Gesendet " , ". " )
196
- )
149
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("SENT MESSAGES " , ". " ))
150
+ );
151
+ $ this ->assertSame (
152
+ MailFolder::TYPE_SENT ,
153
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("Gesendet " , ". " ))
197
154
);
198
155
199
156
157
+
158
+ // FOLDER
159
+ foreach ([
160
+ ["SomeRandomFolder/Draft " , "/ " ],
161
+ ["SomeRandomFolder/Draft/Test " , "/ " ],
162
+ ["SomeRandom " , ". " ],
163
+ ["INBOX/Somefolder/Deep/Drafts " , "/ " ],
164
+ ["INBOX.Trash.Deep.Deeper.Folder " , ". " ],
165
+ ["Junk/Draft " , "/ " ],
166
+ ["TRASH.Draft.folder " , ". " ]
167
+ ] as $ folder ) {
168
+ $ this ->assertSame (
169
+ MailFolder::TYPE_FOLDER ,
170
+ $ mapper ->getFolderType ($ this ->createListMailFolder ($ folder [0 ], $ folder [1 ]))
171
+ );
172
+ }
173
+
174
+
175
+ // GMAIL
200
176
foreach (["Google Mail " , "Gmail " ] as $ label ) {
201
177
$ this ->assertSame (
202
178
MailFolder::TYPE_SENT ,
203
179
$ mapper ->getFolderType ($ this ->createListMailFolder ("[ $ label]/Gesendet " , ". " ))
204
180
);
181
+ $ this ->assertSame (
182
+ MailFolder::TYPE_SENT ,
183
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("[ $ label]/Sent " , ". " ))
184
+ );
205
185
$ this ->assertSame (
206
186
MailFolder::TYPE_DRAFT ,
207
187
$ mapper ->getFolderType ($ this ->createListMailFolder ("[ $ label]/Entwürfe " , ". " ))
208
188
);
209
189
$ this ->assertSame (
190
+ MailFolder::TYPE_DRAFT ,
191
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("[ $ label]/Drafts " , ". " ))
192
+ );
193
+ $ this ->assertNotSame (
210
194
MailFolder::TYPE_INBOX ,
211
195
$ mapper ->getFolderType ($ this ->createListMailFolder ("[ $ label]/Alle Nachrichten " , ". " ))
212
196
);
@@ -218,30 +202,12 @@ public function testGetFolderType()
218
202
MailFolder::TYPE_TRASH ,
219
203
$ mapper ->getFolderType ($ this ->createListMailFolder ("[ $ label]/Papierkorb " , ". " ))
220
204
);
205
+ $ this ->assertSame (
206
+ MailFolder::TYPE_TRASH ,
207
+ $ mapper ->getFolderType ($ this ->createListMailFolder ("[ $ label]/Trash " , ". " ))
208
+ );
221
209
}
222
210
223
-
224
- $ this ->assertSame (
225
- MailFolder::TYPE_TRASH ,
226
- $ mapper ->getFolderType (
227
- $ this ->createListMailFolder ("PapIerKorb " , ". " )
228
- )
229
- );
230
-
231
- $ this ->assertSame (
232
- MailFolder::TYPE_DRAFT ,
233
- $ mapper ->getFolderType (
234
- $ this ->createListMailFolder ("Entwurf " , "/ " )
235
- )
236
- );
237
-
238
- $ this ->assertSame (
239
- MailFolder::TYPE_JUNK ,
240
- $ mapper ->getFolderType (
241
- $ this ->createListMailFolder ("Spam " , "- " )
242
- )
243
- );
244
-
245
211
}
246
212
247
213
0 commit comments