mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2024-12-22 13:12:41 +00:00
Start on test for filtering during feed parsing
This commit is contained in:
parent
9e29235d87
commit
a4146ec129
2 changed files with 75 additions and 0 deletions
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
61
tests/docroot/Feed/Filtering/1.php
Normal file
61
tests/docroot/Feed/Filtering/1.php
Normal file
|
@ -0,0 +1,61 @@
|
|||
<?php return [
|
||||
'mime' => "application/atom+xml",
|
||||
'content' => <<<MESSAGE_BODY
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<title>Example feed title</title>
|
||||
<id>urn:uuid:0fd8f6d8-43df-11e7-8511-9b59a0324eb8</id>
|
||||
<link rel="alternate" type="text/html" href="http://localhost:8000/"/>
|
||||
|
||||
<entry>
|
||||
<id>urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89790</id>
|
||||
<title>A</title>
|
||||
<category>Z</category>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89791</id>
|
||||
<title>B</title>
|
||||
<category>Y</category>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89792</id>
|
||||
<title>C</title>
|
||||
<category>X</category>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89793</id>
|
||||
<title>D</title>
|
||||
<category>W</category>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89794</id>
|
||||
<title>E</title>
|
||||
<category>V</category>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89795</id>
|
||||
<title>F</title>
|
||||
<category>U</category>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89796</id>
|
||||
<title>T</title>
|
||||
<category>Z</category>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89797</id>
|
||||
<title>S</title>
|
||||
<category>Z</category>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89798</id>
|
||||
<title>R</title>
|
||||
<category>Z</category>
|
||||
</entry>
|
||||
<entry>
|
||||
<id>urn:uuid:6d4c7964-43e1-11e7-92bd-4fed65d89799</id>
|
||||
<title>Q</title>
|
||||
<category>Z</category>
|
||||
</entry>
|
||||
</feed>
|
||||
MESSAGE_BODY
|
||||
];
|
Loading…
Reference in a new issue