From bbfce2d9ed3f4c78bd267eb36fb4da73485e33a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20N=C3=BCrnberger?= Date: Thu, 14 Sep 2023 13:51:57 +0200 Subject: [PATCH 1/2] add failing test with symbols in filename --- tests/issues/Issue410Test.php | 14 ++++++++++++++ tests/messages/issue-410symbols.eml | 22 ++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 tests/messages/issue-410symbols.eml diff --git a/tests/issues/Issue410Test.php b/tests/issues/Issue410Test.php index d02724c..6990223 100644 --- a/tests/issues/Issue410Test.php +++ b/tests/issues/Issue410Test.php @@ -49,4 +49,18 @@ public function testIssueEmailB() { self::assertSame("2021_Mängelliste_0819306.xlsx", $attachment->name); } + public function testIssueEmailSymbols() { + $filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-410symbols.eml"]); + $message = Message::fromFile($filename); + + $attachments = $message->getAttachments(); + + self::assertSame(1, $attachments->count()); + + $attachment = $attachments->first(); + self::assertSame("Checkliste 10.,DAVIDGASSE 76-80;2;2.pdf", $attachment->description); + self::assertSame("Checkliste 10.,DAVIDGASSE 76-80;2;2.pdf", $attachment->filename); + self::assertSame("Checkliste 10.,DAVIDGASSE 76-80;2;2.pdf", $attachment->name); + } + } \ No newline at end of file diff --git a/tests/messages/issue-410symbols.eml b/tests/messages/issue-410symbols.eml new file mode 100644 index 0000000..b83a2f2 --- /dev/null +++ b/tests/messages/issue-410symbols.eml @@ -0,0 +1,22 @@ +From: from@there.com +To: to@here.com +Subject: =?iso-8859-1?Q?386_-_400021804_-_19.,_Heiligenst=E4dter_Stra=DFe_80_-_081?= + =?iso-8859-1?Q?9306_-_Anfrage_Vergabevorschlag?= +Date: Wed, 13 Sep 2017 13:05:45 +0200 +MIME-Version: 1.0 +Content-Type: multipart/mixed; + boundary="------------B832AF745285AEEC6D5AEE42" + +Hi +--------------B832AF745285AEEC6D5AEE42 +Content-Type: application/pdf; name="Checkliste 10.,DAVIDGASSE 76-80;2;2.pdf" +Content-Description: Checkliste 10.,DAVIDGASSE 76-80;2;2.pdf +Content-Disposition: attachment; + filename="Checkliste 10.,DAVIDGASSE 76-80;2;2.pdf"; size=3439313; + creation-date="Tue, 12 Sep 2023 06:53:03 GMT"; + modification-date="Tue, 12 Sep 2023 08:18:16 GMT" +Content-ID: <34A0EDD24A954140A472605B7526F190@there.com> +Content-Transfer-Encoding: base64 + +SGkh +--------------B832AF745285AEEC6D5AEE42-- \ No newline at end of file From 48956352b1882a36ea11eea848651b099371b4b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adrian=20N=C3=BCrnberger?= Date: Thu, 14 Sep 2023 16:04:58 +0200 Subject: [PATCH 2/2] use proper test case class --- tests/issues/Issue410Test.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/tests/issues/Issue410Test.php b/tests/issues/Issue410Test.php index 6990223..458c8a1 100644 --- a/tests/issues/Issue410Test.php +++ b/tests/issues/Issue410Test.php @@ -13,14 +13,14 @@ namespace Tests\issues; use PHPUnit\Framework\TestCase; +use Tests\fixtures\FixtureTestCase; use Webklex\PHPIMAP\ClientManager; use Webklex\PHPIMAP\Message; -class Issue410Test extends TestCase { +class Issue410Test extends FixtureTestCase { public function testIssueEmail() { - $filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-410.eml"]); - $message = Message::fromFile($filename); + $message = $this->getFixture("issue-410.eml"); self::assertSame("☆第132号 「ガーデン&エクステリア」専門店のためのQ&Aサロン 【月刊エクステリア・ワーク】", (string)$message->subject); @@ -34,8 +34,7 @@ public function testIssueEmail() { } public function testIssueEmailB() { - $filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-410b.eml"]); - $message = Message::fromFile($filename); + $message = $this->getFixture("issue-410b.eml"); self::assertSame("386 - 400021804 - 19., Heiligenstädter Straße 80 - 0819306 - Anfrage Vergabevorschlag", (string)$message->subject); @@ -50,8 +49,7 @@ public function testIssueEmailB() { } public function testIssueEmailSymbols() { - $filename = implode(DIRECTORY_SEPARATOR, [__DIR__, "..", "messages", "issue-410symbols.eml"]); - $message = Message::fromFile($filename); + $message = $this->getFixture("issue-410symbols.eml"); $attachments = $message->getAttachments();