mirror of
https://code.mensbeam.com/MensBeam/Arsse.git
synced 2025-01-11 10:22:40 +00:00
Test for icon fetching
This commit is contained in:
parent
7c40c81fb3
commit
50fd127ac4
4 changed files with 21 additions and 1 deletions
|
@ -125,7 +125,7 @@ class Feed {
|
|||
// Some feeds might use a different domain (eg: feedburner), so the site url is
|
||||
// used instead of the feed's url.
|
||||
$icon = new Favicon;
|
||||
$this->iconUrl = $icon->find($feed->siteUrl);
|
||||
$this->iconUrl = $icon->find($feed->siteUrl, $feed->getIcon());
|
||||
$this->iconData = $icon->getContent();
|
||||
if (strlen($this->iconData)) {
|
||||
$this->iconType = $icon->getType();
|
||||
|
|
|
@ -347,4 +347,12 @@ class TestFeed extends \JKingWeb\Arsse\Test\AbstractTest {
|
|||
$exp = "<p>Partial content, followed by more content</p>";
|
||||
$this->assertSame($exp, $f->newItems[0]->content);
|
||||
}
|
||||
|
||||
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);
|
||||
$this->assertSame($d, $f->iconData);
|
||||
}
|
||||
}
|
||||
|
|
8
tests/docroot/Feed/Parsing/WithIcon.php
Normal file
8
tests/docroot/Feed/Parsing/WithIcon.php
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?php return [
|
||||
'mime' => "application/atom+xml",
|
||||
'content' => <<<MESSAGE_BODY
|
||||
<feed xmlns="http://www.w3.org/2005/Atom">
|
||||
<icon>/Icon</icon>
|
||||
</feed>
|
||||
MESSAGE_BODY
|
||||
];
|
4
tests/docroot/Icon.php
Normal file
4
tests/docroot/Icon.php
Normal file
|
@ -0,0 +1,4 @@
|
|||
<?php return [
|
||||
'mime' => "image/png",
|
||||
'content' => base64_decode("iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMjHxIGmVAAAADUlEQVQYV2NgYGBgAAAABQABijPjAAAAAABJRU5ErkJggg=="),
|
||||
];
|
Loading…
Reference in a new issue