Skip to content

Commit c123a03

Browse files
refactor: add new folder mapping for type trash/draft/junk
1 parent 8ec557c commit c123a03

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

src/Mail/Client/Imap/Util/DefaultFolderIdToTypeMapper.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ public function getFolderType(ListMailFolder $listMailFolder): string
119119
case "DELETED MESSAGES":
120120
case "GELÖSCHTE ELEMENTE":
121121
case "GELÖSCHT":
122+
case "PAPIERKORB":
122123
case "INBOX" . $delimiter . "TRASH":
123124
case "INBOX" . $delimiter . "PAPIERKORB":
124125
case "INBOX" . $delimiter . "DELETED ITEMS":
@@ -133,6 +134,7 @@ public function getFolderType(ListMailFolder $listMailFolder): string
133134
case "DRAFTS":
134135
case "DRAFT":
135136
case "ENTWÜRFE":
137+
case "ENTWURF":
136138
case "INBOX" . $delimiter . "DRAFTS":
137139
$type = MailFolder::TYPE_DRAFT;
138140
break;
@@ -158,6 +160,7 @@ public function getFolderType(ListMailFolder $listMailFolder): string
158160
case "[GOOGLE MAIL]/SPAM":
159161
case "[GMAIL]/SPAM":
160162
case "JUNK":
163+
case "SPAM":
161164
case "SPAMVERDACHT":
162165
case "INBOX" . $delimiter . "JUNK":
163166
case "INBOX" . $delimiter . "SPAM":

tests/Mail/Client/Imap/Util/DefaultFolderIdToTypeMapperTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -219,6 +219,29 @@ public function testGetFolderType()
219219
$mapper->getFolderType($this->createListMailFolder("[$label]/Papierkorb", "."))
220220
);
221221
}
222+
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+
222245
}
223246

224247

0 commit comments

Comments
 (0)