diff --git a/lib/Feed.php b/lib/Feed.php
index b0e91290..e96d064c 100644
--- a/lib/Feed.php
+++ b/lib/Feed.php
@@ -286,7 +286,7 @@ class Feed {
$articles = Arsse::$db->feedMatchLatest($feedID, sizeof($items))->getAll();
// perform a first pass matching the latest articles against items in the feed
[$this->newItems, $this->changedItems] = $this->matchItems($items, $articles);
- if (sizeof($this->newItems) && sizeof($items) <= sizeof($articles)) {
+ if (sizeof($this->newItems)) {
// if we need to, perform a second pass on the database looking specifically for IDs and hashes of the new items
$ids = $hashesUT = $hashesUC = $hashesTC = [];
foreach ($this->newItems as $i) {
diff --git a/tests/cases/Feed/TestFeed.php b/tests/cases/Feed/TestFeed.php
index a10a476a..51799940 100644
--- a/tests/cases/Feed/TestFeed.php
+++ b/tests/cases/Feed/TestFeed.php
@@ -382,13 +382,22 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest {
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' => ''],
+ // these are the sixth through tenth entries in the feed; the title hashes have been omitted for brevity
+ ['id' => 7, 'guid' => '0f2a218c311e3d8105f1b075142a5d26dabf056ffc61abe77e96c8f071bbf4a7', 'edited' => null, 'url_title_hash' => "", 'url_content_hash' => '', 'title_content_hash' => ''],
+ ['id' => 47, 'guid' => '1c19e3b9018bc246b7414ae919ddebc88d0c575129e8c4a57b84b826c00f6db5', 'edited' => null, 'url_title_hash' => "", 'url_content_hash' => '', 'title_content_hash' => ''],
+ ['id' => 2112, 'guid' => '964db0b9292ad0c7a6c225f2e0966f3bda53486fae65db0310c97409974e65b8', 'edited' => null, 'url_title_hash' => "", 'url_content_hash' => '', 'title_content_hash' => ''],
+ ['id' => 1, 'guid' => '436070cda5713a0d9a8fdc8652c7ab142f0550697acfd5206a16c18aee355039', 'edited' => null, 'url_title_hash' => "", 'url_content_hash' => '', 'title_content_hash' => ''],
+ ['id' => 42, 'guid' => '1a731433a1904220ef26e731ada7262e1d5bcecae53e7b5df9e1f5713af6e5d3', 'edited' => null, 'url_title_hash' => "", 'url_content_hash' => '', 'title_content_hash' => ''],
]));
- $f = new Feed(null, $this->base."Filtering/1");
- $this->markTestIncomplete();
+ \Phake::when(Arsse::$db)->feedRulesGet->thenReturn([
+ 'jack' => ['keep' => "", 'block' => '`A|W|J|S`u'],
+ 'sam' => ['keep' => "`B|T|X`u", 'block' => '`C`u'],
+ ]);
+ $f = new Feed(5, $this->base."Filtering/1");
+ $exp = [
+ 'jack' => ['new' => [false, true, true, false, true], 'changed' => [7 => true, 47 => true, 2112 => false, 1 => true, 42 => false]],
+ 'sam' => ['new' => [false, true, false, false, false], 'changed' => [7 => false, 47 => true, 2112 => false, 1 => false, 42 => false]],
+ ];
+ $this->assertSame($exp, $f->filteredItems);
}
}
diff --git a/tests/docroot/Feed/Filtering/1.php b/tests/docroot/Feed/Filtering/1.php
index d7a1d222..311ac578 100644
--- a/tests/docroot/Feed/Filtering/1.php
+++ b/tests/docroot/Feed/Filtering/1.php
@@ -38,23 +38,23 @@
urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89796
- T
- Z
+ G
+ T
urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89797
- S
- Z
+ H
+ S
urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89798
- R
- Z
+ I
+ R
urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89799
- Q
- Z
+ J
+ Q
MESSAGE_BODY