aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/feed/FeedBuilderTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2020-08-29 10:06:40 +0200
committerArthurHoaro <arthur@hoa.ro>2020-08-29 10:06:40 +0200
commita8e210faa624517ee8b8978b7e659a0b3c689297 (patch)
tree68a1d7671210ac39bc556ee6a54cf969ca7a605f /tests/feed/FeedBuilderTest.php
parentbea062149ebcb4663861edb1cc0a32faf85b273f (diff)
downloadShaarli-a8e210faa624517ee8b8978b7e659a0b3c689297.tar.gz
Shaarli-a8e210faa624517ee8b8978b7e659a0b3c689297.tar.zst
Shaarli-a8e210faa624517ee8b8978b7e659a0b3c689297.zip
Fixed: Pinned bookmarks are displayed first in ATOM/RSS feeds
Fixes #1485
Diffstat (limited to 'tests/feed/FeedBuilderTest.php')
-rw-r--r--tests/feed/FeedBuilderTest.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/tests/feed/FeedBuilderTest.php b/tests/feed/FeedBuilderTest.php
index 5c2aaedb..fe37d5f2 100644
--- a/tests/feed/FeedBuilderTest.php
+++ b/tests/feed/FeedBuilderTest.php
@@ -87,7 +87,7 @@ class FeedBuilderTest extends \PHPUnit\Framework\TestCase
87 $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links'])); 87 $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links']));
88 88
89 // Test first not pinned link (note link) 89 // Test first not pinned link (note link)
90 $link = $data['links'][array_keys($data['links'])[2]]; 90 $link = $data['links'][array_keys($data['links'])[0]];
91 $this->assertEquals(41, $link['id']); 91 $this->assertEquals(41, $link['id']);
92 $this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); 92 $this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
93 $this->assertEquals('http://host.tld/shaare/WDWyig', $link['guid']); 93 $this->assertEquals('http://host.tld/shaare/WDWyig', $link['guid']);
@@ -128,7 +128,7 @@ class FeedBuilderTest extends \PHPUnit\Framework\TestCase
128 $data = $feedBuilder->buildData(FeedBuilder::$FEED_ATOM, null); 128 $data = $feedBuilder->buildData(FeedBuilder::$FEED_ATOM, null);
129 $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links'])); 129 $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links']));
130 $this->assertRegExp('/2016-08-03T09:30:33\+\d{2}:\d{2}/', $data['last_update']); 130 $this->assertRegExp('/2016-08-03T09:30:33\+\d{2}:\d{2}/', $data['last_update']);
131 $link = $data['links'][array_keys($data['links'])[2]]; 131 $link = $data['links'][array_keys($data['links'])[0]];
132 $this->assertRegExp('/2015-03-10T11:46:51\+\d{2}:\d{2}/', $link['pub_iso_date']); 132 $this->assertRegExp('/2015-03-10T11:46:51\+\d{2}:\d{2}/', $link['pub_iso_date']);
133 $this->assertRegExp('/2016-08-03T09:30:33\+\d{2}:\d{2}/', $data['links'][8]['up_iso_date']); 133 $this->assertRegExp('/2016-08-03T09:30:33\+\d{2}:\d{2}/', $data['links'][8]['up_iso_date']);
134 } 134 }
@@ -173,7 +173,7 @@ class FeedBuilderTest extends \PHPUnit\Framework\TestCase
173 $feedBuilder->setLocale(self::$LOCALE); 173 $feedBuilder->setLocale(self::$LOCALE);
174 $data = $feedBuilder->buildData(FeedBuilder::$FEED_ATOM, $criteria); 174 $data = $feedBuilder->buildData(FeedBuilder::$FEED_ATOM, $criteria);
175 $this->assertEquals(3, count($data['links'])); 175 $this->assertEquals(3, count($data['links']));
176 $link = $data['links'][array_keys($data['links'])[2]]; 176 $link = $data['links'][array_keys($data['links'])[0]];
177 $this->assertEquals(41, $link['id']); 177 $this->assertEquals(41, $link['id']);
178 $this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); 178 $this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
179 } 179 }
@@ -195,7 +195,7 @@ class FeedBuilderTest extends \PHPUnit\Framework\TestCase
195 $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links'])); 195 $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links']));
196 $this->assertTrue($data['usepermalinks']); 196 $this->assertTrue($data['usepermalinks']);
197 // First link is a permalink 197 // First link is a permalink
198 $link = $data['links'][array_keys($data['links'])[2]]; 198 $link = $data['links'][array_keys($data['links'])[0]];
199 $this->assertEquals(41, $link['id']); 199 $this->assertEquals(41, $link['id']);
200 $this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); 200 $this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114651'), $link['created']);
201 $this->assertEquals('http://host.tld/shaare/WDWyig', $link['guid']); 201 $this->assertEquals('http://host.tld/shaare/WDWyig', $link['guid']);
@@ -203,7 +203,7 @@ class FeedBuilderTest extends \PHPUnit\Framework\TestCase
203 $this->assertContains('Direct link', $link['description']); 203 $this->assertContains('Direct link', $link['description']);
204 $this->assertContains('http://host.tld/shaare/WDWyig', $link['description']); 204 $this->assertContains('http://host.tld/shaare/WDWyig', $link['description']);
205 // Second link is a direct link 205 // Second link is a direct link
206 $link = $data['links'][array_keys($data['links'])[3]]; 206 $link = $data['links'][array_keys($data['links'])[1]];
207 $this->assertEquals(8, $link['id']); 207 $this->assertEquals(8, $link['id']);
208 $this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114633'), $link['created']); 208 $this->assertEquals(DateTime::createFromFormat(Bookmark::LINK_DATE_FORMAT, '20150310_114633'), $link['created']);
209 $this->assertEquals('http://host.tld/shaare/RttfEw', $link['guid']); 209 $this->assertEquals('http://host.tld/shaare/RttfEw', $link['guid']);
@@ -270,7 +270,7 @@ class FeedBuilderTest extends \PHPUnit\Framework\TestCase
270 ); 270 );
271 271
272 // Test first link (note link) 272 // Test first link (note link)
273 $link = $data['links'][array_keys($data['links'])[2]]; 273 $link = $data['links'][array_keys($data['links'])[0]];
274 $this->assertEquals('http://host.tld:8080/~user/shaarli/shaare/WDWyig', $link['guid']); 274 $this->assertEquals('http://host.tld:8080/~user/shaarli/shaare/WDWyig', $link['guid']);
275 $this->assertEquals('http://host.tld:8080/~user/shaarli/shaare/WDWyig', $link['url']); 275 $this->assertEquals('http://host.tld:8080/~user/shaarli/shaare/WDWyig', $link['url']);
276 $this->assertContains('http://host.tld:8080/~user/shaarli/./add-tag/hashtag', $link['description']); 276 $this->assertContains('http://host.tld:8080/~user/shaarli/./add-tag/hashtag', $link['description']);