diff options
author | ArthurHoaro <arthur@hoa.ro> | 2019-07-27 12:34:30 +0200 |
---|---|---|
committer | ArthurHoaro <arthur@hoa.ro> | 2019-07-27 12:34:30 +0200 |
commit | 38672ba0d1c722e5d6d33a58255ceb55e9410e46 (patch) | |
tree | dae4c7c47532380eac3ae641db99122fc77c93dc /tests/FeedBuilderTest.php | |
parent | 83faedadff76c5bdca036f39f13943f63b27e164 (diff) | |
parent | 1e77e0448bbd25675d8c0fe4a73206ad9048904b (diff) | |
download | Shaarli-38672ba0d1c722e5d6d33a58255ceb55e9410e46.tar.gz Shaarli-38672ba0d1c722e5d6d33a58255ceb55e9410e46.tar.zst Shaarli-38672ba0d1c722e5d6d33a58255ceb55e9410e46.zip |
Merge tag 'v0.10.4' into stable
Release v0.10.4
Diffstat (limited to 'tests/FeedBuilderTest.php')
-rw-r--r-- | tests/FeedBuilderTest.php | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/tests/FeedBuilderTest.php b/tests/FeedBuilderTest.php index a590306d..4ca58e5a 100644 --- a/tests/FeedBuilderTest.php +++ b/tests/FeedBuilderTest.php | |||
@@ -82,8 +82,8 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase | |||
82 | $this->assertFalse($data['usepermalinks']); | 82 | $this->assertFalse($data['usepermalinks']); |
83 | $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links'])); | 83 | $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links'])); |
84 | 84 | ||
85 | // Test first link (note link) | 85 | // Test first not pinned link (note link) |
86 | $link = reset($data['links']); | 86 | $link = $data['links'][array_keys($data['links'])[2]]; |
87 | $this->assertEquals(41, $link['id']); | 87 | $this->assertEquals(41, $link['id']); |
88 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); | 88 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); |
89 | $this->assertEquals('http://host.tld/?WDWyig', $link['guid']); | 89 | $this->assertEquals('http://host.tld/?WDWyig', $link['guid']); |
@@ -119,7 +119,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase | |||
119 | $data = $feedBuilder->buildData(); | 119 | $data = $feedBuilder->buildData(); |
120 | $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links'])); | 120 | $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links'])); |
121 | $this->assertRegExp('/2016-08-03T09:30:33\+\d{2}:\d{2}/', $data['last_update']); | 121 | $this->assertRegExp('/2016-08-03T09:30:33\+\d{2}:\d{2}/', $data['last_update']); |
122 | $link = reset($data['links']); | 122 | $link = $data['links'][array_keys($data['links'])[2]]; |
123 | $this->assertRegExp('/2015-03-10T11:46:51\+\d{2}:\d{2}/', $link['pub_iso_date']); | 123 | $this->assertRegExp('/2015-03-10T11:46:51\+\d{2}:\d{2}/', $link['pub_iso_date']); |
124 | $this->assertRegExp('/2016-08-03T09:30:33\+\d{2}:\d{2}/', $data['links'][8]['up_iso_date']); | 124 | $this->assertRegExp('/2016-08-03T09:30:33\+\d{2}:\d{2}/', $data['links'][8]['up_iso_date']); |
125 | } | 125 | } |
@@ -148,13 +148,13 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase | |||
148 | public function testBuildDataCount() | 148 | public function testBuildDataCount() |
149 | { | 149 | { |
150 | $criteria = array( | 150 | $criteria = array( |
151 | 'nb' => '1', | 151 | 'nb' => '3', |
152 | ); | 152 | ); |
153 | $feedBuilder = new FeedBuilder(self::$linkDB, FeedBuilder::$FEED_ATOM, self::$serverInfo, $criteria, false); | 153 | $feedBuilder = new FeedBuilder(self::$linkDB, FeedBuilder::$FEED_ATOM, self::$serverInfo, $criteria, false); |
154 | $feedBuilder->setLocale(self::$LOCALE); | 154 | $feedBuilder->setLocale(self::$LOCALE); |
155 | $data = $feedBuilder->buildData(); | 155 | $data = $feedBuilder->buildData(); |
156 | $this->assertEquals(1, count($data['links'])); | 156 | $this->assertEquals(3, count($data['links'])); |
157 | $link = array_shift($data['links']); | 157 | $link = $data['links'][array_keys($data['links'])[2]]; |
158 | $this->assertEquals(41, $link['id']); | 158 | $this->assertEquals(41, $link['id']); |
159 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); | 159 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); |
160 | } | 160 | } |
@@ -171,7 +171,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase | |||
171 | $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links'])); | 171 | $this->assertEquals(ReferenceLinkDB::$NB_LINKS_TOTAL, count($data['links'])); |
172 | $this->assertTrue($data['usepermalinks']); | 172 | $this->assertTrue($data['usepermalinks']); |
173 | // First link is a permalink | 173 | // First link is a permalink |
174 | $link = array_shift($data['links']); | 174 | $link = $data['links'][array_keys($data['links'])[2]]; |
175 | $this->assertEquals(41, $link['id']); | 175 | $this->assertEquals(41, $link['id']); |
176 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); | 176 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); |
177 | $this->assertEquals('http://host.tld/?WDWyig', $link['guid']); | 177 | $this->assertEquals('http://host.tld/?WDWyig', $link['guid']); |
@@ -179,7 +179,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase | |||
179 | $this->assertContains('Direct link', $link['description']); | 179 | $this->assertContains('Direct link', $link['description']); |
180 | $this->assertContains('http://host.tld/?WDWyig', $link['description']); | 180 | $this->assertContains('http://host.tld/?WDWyig', $link['description']); |
181 | // Second link is a direct link | 181 | // Second link is a direct link |
182 | $link = array_shift($data['links']); | 182 | $link = $data['links'][array_keys($data['links'])[3]]; |
183 | $this->assertEquals(8, $link['id']); | 183 | $this->assertEquals(8, $link['id']); |
184 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114633'), $link['created']); | 184 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114633'), $link['created']); |
185 | $this->assertEquals('http://host.tld/?RttfEw', $link['guid']); | 185 | $this->assertEquals('http://host.tld/?RttfEw', $link['guid']); |
@@ -237,7 +237,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase | |||
237 | ); | 237 | ); |
238 | 238 | ||
239 | // Test first link (note link) | 239 | // Test first link (note link) |
240 | $link = array_shift($data['links']); | 240 | $link = $data['links'][array_keys($data['links'])[2]]; |
241 | $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['guid']); | 241 | $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['guid']); |
242 | $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['url']); | 242 | $this->assertEquals('http://host.tld:8080/~user/shaarli/?WDWyig', $link['url']); |
243 | $this->assertContains('http://host.tld:8080/~user/shaarli/?addtag=hashtag', $link['description']); | 243 | $this->assertContains('http://host.tld:8080/~user/shaarli/?addtag=hashtag', $link['description']); |