From bd650765e1fcf2eb8f26a5644ffcc62837d9f0d8 Mon Sep 17 00:00:00 2001 From: "J. King" Date: Thu, 5 Nov 2020 12:12:01 -0500 Subject: [PATCH] Generalize icon fetching tests --- .gitignore | 1 - tests/cases/Feed/TestFeed.php | 8 ++++---- .../Feed/{Parsing/WithIcon.php => WithIcon/GIF.php} | 2 +- tests/docroot/Feed/WithIcon/PNG.php | 8 ++++++++ tests/docroot/Feed/WithIcon/SVG1.php | 8 ++++++++ tests/docroot/Feed/WithIcon/SVG2.php | 8 ++++++++ tests/docroot/Icon/GIF.php | 4 ++++ tests/docroot/{Icon.php => Icon/PNG.php} | 0 tests/docroot/Icon/SVG1.php | 4 ++++ tests/docroot/Icon/SVG2.php | 4 ++++ 10 files changed, 41 insertions(+), 6 deletions(-) rename tests/docroot/Feed/{Parsing/WithIcon.php => WithIcon/GIF.php} (85%) create mode 100644 tests/docroot/Feed/WithIcon/PNG.php create mode 100644 tests/docroot/Feed/WithIcon/SVG1.php create mode 100644 tests/docroot/Feed/WithIcon/SVG2.php create mode 100644 tests/docroot/Icon/GIF.php rename tests/docroot/{Icon.php => Icon/PNG.php} (100%) create mode 100644 tests/docroot/Icon/SVG1.php create mode 100644 tests/docroot/Icon/SVG2.php diff --git a/.gitignore b/.gitignore index d90e245d..16e9c935 100644 --- a/.gitignore +++ b/.gitignore @@ -26,7 +26,6 @@ $RECYCLE.BIN/ .DS_Store .AppleDouble .LSOverride -Icon ._* .Spotlight-V100 .Trashes diff --git a/tests/cases/Feed/TestFeed.php b/tests/cases/Feed/TestFeed.php index 562d9063..a5036d28 100644 --- a/tests/cases/Feed/TestFeed.php +++ b/tests/cases/Feed/TestFeed.php @@ -349,10 +349,10 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { } public function testFetchWithIcon(): void { - $d = base64_decode("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAAADUlEQVQYV2NgYGBgAAAABQABijPjAAAAAABJRU5ErkJggg=="); - $f = new Feed(null, $this->base."Parsing/WithIcon"); - $this->assertSame(self::$host."Icon", $f->iconUrl); - $this->assertSame("image/png", $f->iconType); + $d = base64_decode("R0lGODlhAQABAIABAAAAAP///yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="); + $f = new Feed(null, $this->base."WithIcon/GIF"); + $this->assertSame(self::$host."Icon/GIF", $f->iconUrl); + $this->assertSame("image/gif", $f->iconType); $this->assertSame($d, $f->iconData); } } diff --git a/tests/docroot/Feed/Parsing/WithIcon.php b/tests/docroot/Feed/WithIcon/GIF.php similarity index 85% rename from tests/docroot/Feed/Parsing/WithIcon.php rename to tests/docroot/Feed/WithIcon/GIF.php index 4f1f2776..8b81b58c 100644 --- a/tests/docroot/Feed/Parsing/WithIcon.php +++ b/tests/docroot/Feed/WithIcon/GIF.php @@ -2,7 +2,7 @@ 'mime' => "application/atom+xml", 'content' => << - /Icon + /Icon/GIF MESSAGE_BODY ]; diff --git a/tests/docroot/Feed/WithIcon/PNG.php b/tests/docroot/Feed/WithIcon/PNG.php new file mode 100644 index 00000000..3bca1c9a --- /dev/null +++ b/tests/docroot/Feed/WithIcon/PNG.php @@ -0,0 +1,8 @@ + "application/atom+xml", + 'content' => << + /Icon/PNG + +MESSAGE_BODY +]; diff --git a/tests/docroot/Feed/WithIcon/SVG1.php b/tests/docroot/Feed/WithIcon/SVG1.php new file mode 100644 index 00000000..5f5acc87 --- /dev/null +++ b/tests/docroot/Feed/WithIcon/SVG1.php @@ -0,0 +1,8 @@ + "application/atom+xml", + 'content' => << + /Icon/SVG1 + +MESSAGE_BODY +]; diff --git a/tests/docroot/Feed/WithIcon/SVG2.php b/tests/docroot/Feed/WithIcon/SVG2.php new file mode 100644 index 00000000..aca3c79c --- /dev/null +++ b/tests/docroot/Feed/WithIcon/SVG2.php @@ -0,0 +1,8 @@ + "application/atom+xml", + 'content' => << + /Icon/SVG2 + +MESSAGE_BODY +]; diff --git a/tests/docroot/Icon/GIF.php b/tests/docroot/Icon/GIF.php new file mode 100644 index 00000000..50f0b78c --- /dev/null +++ b/tests/docroot/Icon/GIF.php @@ -0,0 +1,4 @@ + "image/gif", + 'content' => base64_decode("R0lGODlhAQABAIABAAAAAP///yH5BAEKAAEALAAAAAABAAEAAAICTAEAOw=="), +]; diff --git a/tests/docroot/Icon.php b/tests/docroot/Icon/PNG.php similarity index 100% rename from tests/docroot/Icon.php rename to tests/docroot/Icon/PNG.php diff --git a/tests/docroot/Icon/SVG1.php b/tests/docroot/Icon/SVG1.php new file mode 100644 index 00000000..0543d91a --- /dev/null +++ b/tests/docroot/Icon/SVG1.php @@ -0,0 +1,4 @@ + "image/svg+xml", + 'content' => '' +]; diff --git a/tests/docroot/Icon/SVG2.php b/tests/docroot/Icon/SVG2.php new file mode 100644 index 00000000..4ade7ce4 --- /dev/null +++ b/tests/docroot/Icon/SVG2.php @@ -0,0 +1,4 @@ + "image/svg+xml", + 'content' => '' +];