From 9ad4a37ddfdc84e93139d7e6448d5f46e47597cd Mon Sep 17 00:00:00 2001 From: "J. King" Date: Tue, 9 Feb 2021 09:26:12 -0500 Subject: [PATCH] Tests and fixes for Miniflux with PDO --- lib/REST/Miniflux/V1.php | 6 +++--- tests/cases/REST/Miniflux/PDO/TestV1.php | 13 +++++++++++++ tests/phpunit.dist.xml | 1 + 3 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 tests/cases/REST/Miniflux/PDO/TestV1.php diff --git a/lib/REST/Miniflux/V1.php b/lib/REST/Miniflux/V1.php index 4e4c959..1a52954 100644 --- a/lib/REST/Miniflux/V1.php +++ b/lib/REST/Miniflux/V1.php @@ -880,7 +880,7 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler { return new ErrorResponse("404", 404); } return new Response([ - 'id' => $icon['id'], + 'id' => (int) $icon['id'], 'data' => $icon['type'].";base64,".base64_encode($icon['data']), 'mime_type' => $icon['type'], ]); @@ -954,9 +954,9 @@ class V1 extends \JKingWeb\Arsse\REST\AbstractHandler { if ($entry['media_url']) { $enclosures = [ [ - 'id' => $entry['id'], // NOTE: We don't have IDs for enclosures, but we also only have one enclosure per entry, so we can just re-use the same ID + 'id' => (int) $entry['id'], // NOTE: We don't have IDs for enclosures, but we also only have one enclosure per entry, so we can just re-use the same ID 'user_id' => $uid, - 'entry_id' => $entry['id'], + 'entry_id' => (int) $entry['id'], 'url' => $entry['media_url'], 'mime_type' => $entry['media_type'] ?: "application/octet-stream", 'size' => 0, diff --git a/tests/cases/REST/Miniflux/PDO/TestV1.php b/tests/cases/REST/Miniflux/PDO/TestV1.php new file mode 100644 index 0000000..977ffa4 --- /dev/null +++ b/tests/cases/REST/Miniflux/PDO/TestV1.php @@ -0,0 +1,13 @@ + + * @group optional */ +class TestV1 extends \JKingWeb\Arsse\TestCase\REST\Miniflux\TestV1 { + use \JKingWeb\Arsse\Test\PDOTest; +} diff --git a/tests/phpunit.dist.xml b/tests/phpunit.dist.xml index 3d57606..99831a4 100644 --- a/tests/phpunit.dist.xml +++ b/tests/phpunit.dist.xml @@ -118,6 +118,7 @@ cases/REST/Miniflux/TestErrorResponse.php cases/REST/Miniflux/TestStatus.php cases/REST/Miniflux/TestV1.php + cases/REST/Miniflux/PDO/TestV1.php cases/REST/NextcloudNews/TestVersions.php