From a4146ec129f9337ab7236897137b75ae9a19897e Mon Sep 17 00:00:00 2001 From: "J. King" Date: Mon, 11 Jan 2021 09:53:09 -0500 Subject: [PATCH] Start on test for filtering during feed parsing --- tests/cases/Feed/TestFeed.php | 14 +++++++ tests/docroot/Feed/Filtering/1.php | 61 ++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 tests/docroot/Feed/Filtering/1.php diff --git a/tests/cases/Feed/TestFeed.php b/tests/cases/Feed/TestFeed.php index cb94c5e7..a10a476a 100644 --- a/tests/cases/Feed/TestFeed.php +++ b/tests/cases/Feed/TestFeed.php @@ -95,6 +95,8 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { self::clearData(); self::setConf(); Arsse::$db = \Phake::mock(Database::class); + \Phake::when(Arsse::$db)->feedMatchLatest->thenReturn(new Result([])); + \Phake::when(Arsse::$db)->feedMatchIds->thenReturn(new Result([])); \Phake::when(Arsse::$db)->feedRulesGet->thenReturn([]); } @@ -377,4 +379,16 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest { $this->assertSame("image/gif", $f->iconType); $this->assertSame($d, $f->iconData); } + + public function testApplyFilterRules(): void { + \Phake::when(Arsse::$db)->feedMatchIds->thenReturn(new Result([ + ['id' => 7, 'guid' => '0f2a218c311e3d8105f1b075142a5d26dabf056ffc61abe77e96c8f071bbf4a7', 'url_title_hash' => "", 'url_content_hash' => '', 'title_content_hash' => ''], + ['id' => 47, 'guid' => '1c19e3b9018bc246b7414ae919ddebc88d0c575129e8c4a57b84b826c00f6db5', 'url_title_hash' => "", 'url_content_hash' => '', 'title_content_hash' => ''], + ['id' => 2112, 'guid' => '964db0b9292ad0c7a6c225f2e0966f3bda53486fae65db0310c97409974e65b8', 'url_title_hash' => "", 'url_content_hash' => '', 'title_content_hash' => ''], + ['id' => 1, 'guid' => '436070cda5713a0d9a8fdc8652c7ab142f0550697acfd5206a16c18aee355039', 'url_title_hash' => "", 'url_content_hash' => '', 'title_content_hash' => ''], + ['id' => 42, 'guid' => '1a731433a1904220ef26e731ada7262e1d5bcecae53e7b5df9e1f5713af6e5d3', 'url_title_hash' => "", 'url_content_hash' => '', 'title_content_hash' => ''], + ])); + $f = new Feed(null, $this->base."Filtering/1"); + $this->markTestIncomplete(); + } } diff --git a/tests/docroot/Feed/Filtering/1.php b/tests/docroot/Feed/Filtering/1.php new file mode 100644 index 00000000..d7a1d222 --- /dev/null +++ b/tests/docroot/Feed/Filtering/1.php @@ -0,0 +1,61 @@ + "application/atom+xml", + 'content' => << + Example feed title + urn:uuid:0fd8f6d8-43df-11e7-8511-9b59a0324eb8 + + + + urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89790 + A + Z + + + urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89791 + B + Y + + + urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89792 + C + X + + + urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89793 + D + W + + + urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89794 + E + V + + + urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89795 + F + U + + + urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89796 + T + Z + + + urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89797 + S + Z + + + urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89798 + R + Z + + + urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89799 + Q + Z + + +MESSAGE_BODY +];