diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/FeedBuilderTest.php | 10 | ||||
-rw-r--r-- | tests/LinkDBTest.php | 22 | ||||
-rw-r--r-- | tests/NetscapeBookmarkUtils/BookmarkImportTest.php | 26 | ||||
-rw-r--r-- | tests/Updater/UpdaterTest.php | 8 | ||||
-rw-r--r-- | tests/plugins/PluginIssoTest.php | 21 | ||||
-rw-r--r-- | tests/utils/ReferenceLinkDB.php | 20 |
6 files changed, 59 insertions, 48 deletions
diff --git a/tests/FeedBuilderTest.php b/tests/FeedBuilderTest.php index ea1dde25..06a44506 100644 --- a/tests/FeedBuilderTest.php +++ b/tests/FeedBuilderTest.php | |||
@@ -86,7 +86,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase | |||
86 | // Test first link (note link) | 86 | // Test first link (note link) |
87 | $link = reset($data['links']); | 87 | $link = reset($data['links']); |
88 | $this->assertEquals(41, $link['id']); | 88 | $this->assertEquals(41, $link['id']); |
89 | $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20150310_114651'), $link['created']); | 89 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); |
90 | $this->assertEquals('http://host.tld/?WDWyig', $link['guid']); | 90 | $this->assertEquals('http://host.tld/?WDWyig', $link['guid']); |
91 | $this->assertEquals('http://host.tld/?WDWyig', $link['url']); | 91 | $this->assertEquals('http://host.tld/?WDWyig', $link['url']); |
92 | $this->assertRegExp('/Tue, 10 Mar 2015 11:46:51 \+\d{4}/', $link['pub_iso_date']); | 92 | $this->assertRegExp('/Tue, 10 Mar 2015 11:46:51 \+\d{4}/', $link['pub_iso_date']); |
@@ -140,7 +140,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase | |||
140 | $this->assertEquals(1, count($data['links'])); | 140 | $this->assertEquals(1, count($data['links'])); |
141 | $link = array_shift($data['links']); | 141 | $link = array_shift($data['links']); |
142 | $this->assertEquals(41, $link['id']); | 142 | $this->assertEquals(41, $link['id']); |
143 | $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20150310_114651'), $link['created']); | 143 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); |
144 | } | 144 | } |
145 | 145 | ||
146 | /** | 146 | /** |
@@ -157,7 +157,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase | |||
157 | $this->assertEquals(1, count($data['links'])); | 157 | $this->assertEquals(1, count($data['links'])); |
158 | $link = array_shift($data['links']); | 158 | $link = array_shift($data['links']); |
159 | $this->assertEquals(41, $link['id']); | 159 | $this->assertEquals(41, $link['id']); |
160 | $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20150310_114651'), $link['created']); | 160 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); |
161 | } | 161 | } |
162 | 162 | ||
163 | /** | 163 | /** |
@@ -174,7 +174,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase | |||
174 | // First link is a permalink | 174 | // First link is a permalink |
175 | $link = array_shift($data['links']); | 175 | $link = array_shift($data['links']); |
176 | $this->assertEquals(41, $link['id']); | 176 | $this->assertEquals(41, $link['id']); |
177 | $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20150310_114651'), $link['created']); | 177 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), $link['created']); |
178 | $this->assertEquals('http://host.tld/?WDWyig', $link['guid']); | 178 | $this->assertEquals('http://host.tld/?WDWyig', $link['guid']); |
179 | $this->assertEquals('http://host.tld/?WDWyig', $link['url']); | 179 | $this->assertEquals('http://host.tld/?WDWyig', $link['url']); |
180 | $this->assertContains('Direct link', $link['description']); | 180 | $this->assertContains('Direct link', $link['description']); |
@@ -182,7 +182,7 @@ class FeedBuilderTest extends PHPUnit_Framework_TestCase | |||
182 | // Second link is a direct link | 182 | // Second link is a direct link |
183 | $link = array_shift($data['links']); | 183 | $link = array_shift($data['links']); |
184 | $this->assertEquals(8, $link['id']); | 184 | $this->assertEquals(8, $link['id']); |
185 | $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20150310_114633'), $link['created']); | 185 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114633'), $link['created']); |
186 | $this->assertEquals('http://host.tld/?RttfEw', $link['guid']); | 186 | $this->assertEquals('http://host.tld/?RttfEw', $link['guid']); |
187 | $this->assertEquals('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['url']); | 187 | $this->assertEquals('https://static.fsf.org/nosvn/faif-2.0.pdf', $link['url']); |
188 | $this->assertContains('Direct link', $link['description']); | 188 | $this->assertContains('Direct link', $link['description']); |
diff --git a/tests/LinkDBTest.php b/tests/LinkDBTest.php index bedc680e..1f62a34a 100644 --- a/tests/LinkDBTest.php +++ b/tests/LinkDBTest.php | |||
@@ -191,7 +191,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase | |||
191 | 'url'=>'http://dum.my', | 191 | 'url'=>'http://dum.my', |
192 | 'description'=>'One more', | 192 | 'description'=>'One more', |
193 | 'private'=>0, | 193 | 'private'=>0, |
194 | 'created'=> DateTime::createFromFormat('Ymd_His', '20150518_190000'), | 194 | 'created'=> DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150518_190000'), |
195 | 'tags'=>'unit test' | 195 | 'tags'=>'unit test' |
196 | ); | 196 | ); |
197 | $testDB[$link['id']] = $link; | 197 | $testDB[$link['id']] = $link; |
@@ -447,17 +447,17 @@ class LinkDBTest extends PHPUnit_Framework_TestCase | |||
447 | */ | 447 | */ |
448 | public function testReorderLinksDesc() | 448 | public function testReorderLinksDesc() |
449 | { | 449 | { |
450 | self::$publicLinkDB->reorder('ASC'); | 450 | self::$privateLinkDB->reorder('ASC'); |
451 | $linkIdToTest = 42; | 451 | $linkIds = array(42, 4, 1, 0, 7, 6, 8, 41); |
452 | foreach (self::$publicLinkDB as $key => $value) { | 452 | $cpt = 0; |
453 | $this->assertEquals($linkIdToTest, $key); | 453 | foreach (self::$privateLinkDB as $key => $value) { |
454 | break; | 454 | $this->assertEquals($linkIds[$cpt++], $key); |
455 | } | 455 | } |
456 | self::$publicLinkDB->reorder('DESC'); | 456 | self::$privateLinkDB->reorder('DESC'); |
457 | $linkIdToTest = 41; | 457 | $linkIds = array_reverse($linkIds); |
458 | foreach (self::$publicLinkDB as $key => $value) { | 458 | $cpt = 0; |
459 | $this->assertEquals($linkIdToTest, $key); | 459 | foreach (self::$privateLinkDB as $key => $value) { |
460 | break; | 460 | $this->assertEquals($linkIds[$cpt++], $key); |
461 | } | 461 | } |
462 | } | 462 | } |
463 | } | 463 | } |
diff --git a/tests/NetscapeBookmarkUtils/BookmarkImportTest.php b/tests/NetscapeBookmarkUtils/BookmarkImportTest.php index 96895b00..0ca07eac 100644 --- a/tests/NetscapeBookmarkUtils/BookmarkImportTest.php +++ b/tests/NetscapeBookmarkUtils/BookmarkImportTest.php | |||
@@ -116,7 +116,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
116 | $this->assertEquals( | 116 | $this->assertEquals( |
117 | array( | 117 | array( |
118 | 'id' => 0, | 118 | 'id' => 0, |
119 | 'created' => DateTime::createFromFormat('Ymd_His', '20160618_203944'), | 119 | 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160618_203944'), |
120 | 'title' => 'Hg Init a Mercurial tutorial by Joel Spolsky', | 120 | 'title' => 'Hg Init a Mercurial tutorial by Joel Spolsky', |
121 | 'url' => 'http://hginit.com/', | 121 | 'url' => 'http://hginit.com/', |
122 | 'description' => '', | 122 | 'description' => '', |
@@ -145,7 +145,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
145 | $this->assertEquals( | 145 | $this->assertEquals( |
146 | array( | 146 | array( |
147 | 'id' => 0, | 147 | 'id' => 0, |
148 | 'created' => DateTime::createFromFormat('Ymd_His', '20160225_235541'), | 148 | 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160225_235541'), |
149 | 'title' => 'Nested 1', | 149 | 'title' => 'Nested 1', |
150 | 'url' => 'http://nest.ed/1', | 150 | 'url' => 'http://nest.ed/1', |
151 | 'description' => '', | 151 | 'description' => '', |
@@ -158,7 +158,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
158 | $this->assertEquals( | 158 | $this->assertEquals( |
159 | array( | 159 | array( |
160 | 'id' => 1, | 160 | 'id' => 1, |
161 | 'created' => DateTime::createFromFormat('Ymd_His', '20160225_235542'), | 161 | 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160225_235542'), |
162 | 'title' => 'Nested 1-1', | 162 | 'title' => 'Nested 1-1', |
163 | 'url' => 'http://nest.ed/1-1', | 163 | 'url' => 'http://nest.ed/1-1', |
164 | 'description' => '', | 164 | 'description' => '', |
@@ -171,7 +171,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
171 | $this->assertEquals( | 171 | $this->assertEquals( |
172 | array( | 172 | array( |
173 | 'id' => 2, | 173 | 'id' => 2, |
174 | 'created' => DateTime::createFromFormat('Ymd_His', '20160225_235547'), | 174 | 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160225_235547'), |
175 | 'title' => 'Nested 1-2', | 175 | 'title' => 'Nested 1-2', |
176 | 'url' => 'http://nest.ed/1-2', | 176 | 'url' => 'http://nest.ed/1-2', |
177 | 'description' => '', | 177 | 'description' => '', |
@@ -184,7 +184,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
184 | $this->assertEquals( | 184 | $this->assertEquals( |
185 | array( | 185 | array( |
186 | 'id' => 3, | 186 | 'id' => 3, |
187 | 'created' => DateTime::createFromFormat('Ymd_His', '20160202_202222'), | 187 | 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160202_202222'), |
188 | 'title' => 'Nested 2-1', | 188 | 'title' => 'Nested 2-1', |
189 | 'url' => 'http://nest.ed/2-1', | 189 | 'url' => 'http://nest.ed/2-1', |
190 | 'description' => 'First link of the second section', | 190 | 'description' => 'First link of the second section', |
@@ -197,7 +197,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
197 | $this->assertEquals( | 197 | $this->assertEquals( |
198 | array( | 198 | array( |
199 | 'id' => 4, | 199 | 'id' => 4, |
200 | 'created' => DateTime::createFromFormat('Ymd_His', '20160119_230227'), | 200 | 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160119_230227'), |
201 | 'title' => 'Nested 2-2', | 201 | 'title' => 'Nested 2-2', |
202 | 'url' => 'http://nest.ed/2-2', | 202 | 'url' => 'http://nest.ed/2-2', |
203 | 'description' => 'Second link of the second section', | 203 | 'description' => 'Second link of the second section', |
@@ -210,7 +210,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
210 | $this->assertEquals( | 210 | $this->assertEquals( |
211 | array( | 211 | array( |
212 | 'id' => 5, | 212 | 'id' => 5, |
213 | 'created' => DateTime::createFromFormat('Ymd_His', '20160202_202222'), | 213 | 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160202_202222'), |
214 | 'title' => 'Nested 3-1', | 214 | 'title' => 'Nested 3-1', |
215 | 'url' => 'http://nest.ed/3-1', | 215 | 'url' => 'http://nest.ed/3-1', |
216 | 'description' => '', | 216 | 'description' => '', |
@@ -223,7 +223,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
223 | $this->assertEquals( | 223 | $this->assertEquals( |
224 | array( | 224 | array( |
225 | 'id' => 6, | 225 | 'id' => 6, |
226 | 'created' => DateTime::createFromFormat('Ymd_His', '20160119_230227'), | 226 | 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160119_230227'), |
227 | 'title' => 'Nested 3-2', | 227 | 'title' => 'Nested 3-2', |
228 | 'url' => 'http://nest.ed/3-2', | 228 | 'url' => 'http://nest.ed/3-2', |
229 | 'description' => '', | 229 | 'description' => '', |
@@ -236,7 +236,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
236 | $this->assertEquals( | 236 | $this->assertEquals( |
237 | array( | 237 | array( |
238 | 'id' => 7, | 238 | 'id' => 7, |
239 | 'created' => DateTime::createFromFormat('Ymd_His', '20160229_111541'), | 239 | 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160229_111541'), |
240 | 'title' => 'Nested 2', | 240 | 'title' => 'Nested 2', |
241 | 'url' => 'http://nest.ed/2', | 241 | 'url' => 'http://nest.ed/2', |
242 | 'description' => '', | 242 | 'description' => '', |
@@ -269,7 +269,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
269 | array( | 269 | array( |
270 | 'id' => 0, | 270 | 'id' => 0, |
271 | // Old link - UTC+4 (note that TZ in the import file is ignored). | 271 | // Old link - UTC+4 (note that TZ in the import file is ignored). |
272 | 'created' => DateTime::createFromFormat('Ymd_His', '20001010_135536'), | 272 | 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20001010_135536'), |
273 | 'title' => 'Secret stuff', | 273 | 'title' => 'Secret stuff', |
274 | 'url' => 'https://private.tld', | 274 | 'url' => 'https://private.tld', |
275 | 'description' => "Super-secret stuff you're not supposed to know about", | 275 | 'description' => "Super-secret stuff you're not supposed to know about", |
@@ -282,7 +282,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
282 | $this->assertEquals( | 282 | $this->assertEquals( |
283 | array( | 283 | array( |
284 | 'id' => 1, | 284 | 'id' => 1, |
285 | 'created' => DateTime::createFromFormat('Ymd_His', '20160225_235548'), | 285 | 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160225_235548'), |
286 | 'title' => 'Public stuff', | 286 | 'title' => 'Public stuff', |
287 | 'url' => 'http://public.tld', | 287 | 'url' => 'http://public.tld', |
288 | 'description' => '', | 288 | 'description' => '', |
@@ -313,7 +313,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
313 | array( | 313 | array( |
314 | 'id' => 0, | 314 | 'id' => 0, |
315 | // Note that TZ in the import file is ignored. | 315 | // Note that TZ in the import file is ignored. |
316 | 'created' => DateTime::createFromFormat('Ymd_His', '20001010_135536'), | 316 | 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20001010_135536'), |
317 | 'title' => 'Secret stuff', | 317 | 'title' => 'Secret stuff', |
318 | 'url' => 'https://private.tld', | 318 | 'url' => 'https://private.tld', |
319 | 'description' => "Super-secret stuff you're not supposed to know about", | 319 | 'description' => "Super-secret stuff you're not supposed to know about", |
@@ -326,7 +326,7 @@ class BookmarkImportTest extends PHPUnit_Framework_TestCase | |||
326 | $this->assertEquals( | 326 | $this->assertEquals( |
327 | array( | 327 | array( |
328 | 'id' => 1, | 328 | 'id' => 1, |
329 | 'created' => DateTime::createFromFormat('Ymd_His', '20160225_235548'), | 329 | 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160225_235548'), |
330 | 'title' => 'Public stuff', | 330 | 'title' => 'Public stuff', |
331 | 'url' => 'http://public.tld', | 331 | 'url' => 'http://public.tld', |
332 | 'description' => '', | 332 | 'description' => '', |
diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php index b8a050b0..4948fe52 100644 --- a/tests/Updater/UpdaterTest.php +++ b/tests/Updater/UpdaterTest.php | |||
@@ -352,20 +352,20 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; | |||
352 | $this->assertEquals('Naming conventions... #private', $linkDB[0]['description']); | 352 | $this->assertEquals('Naming conventions... #private', $linkDB[0]['description']); |
353 | $this->assertEquals('samba cartoon web', $linkDB[0]['tags']); | 353 | $this->assertEquals('samba cartoon web', $linkDB[0]['tags']); |
354 | $this->assertTrue($linkDB[0]['private']); | 354 | $this->assertTrue($linkDB[0]['private']); |
355 | $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20121206_142300'), $linkDB[0]['created']); | 355 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_142300'), $linkDB[0]['created']); |
356 | 356 | ||
357 | $this->assertTrue(isset($linkDB[1])); | 357 | $this->assertTrue(isset($linkDB[1])); |
358 | $this->assertFalse(isset($linkDB[1]['linkdate'])); | 358 | $this->assertFalse(isset($linkDB[1]['linkdate'])); |
359 | $this->assertEquals(1, $linkDB[1]['id']); | 359 | $this->assertEquals(1, $linkDB[1]['id']); |
360 | $this->assertEquals('UserFriendly - Samba', $linkDB[1]['title']); | 360 | $this->assertEquals('UserFriendly - Samba', $linkDB[1]['title']); |
361 | $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20121206_172539'), $linkDB[1]['created']); | 361 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_172539'), $linkDB[1]['created']); |
362 | 362 | ||
363 | $this->assertTrue(isset($linkDB[2])); | 363 | $this->assertTrue(isset($linkDB[2])); |
364 | $this->assertFalse(isset($linkDB[2]['linkdate'])); | 364 | $this->assertFalse(isset($linkDB[2]['linkdate'])); |
365 | $this->assertEquals(2, $linkDB[2]['id']); | 365 | $this->assertEquals(2, $linkDB[2]['id']); |
366 | $this->assertEquals('Geek and Poke', $linkDB[2]['title']); | 366 | $this->assertEquals('Geek and Poke', $linkDB[2]['title']); |
367 | $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20121206_182539'), $linkDB[2]['created']); | 367 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_182539'), $linkDB[2]['created']); |
368 | $this->assertEquals(DateTime::createFromFormat('Ymd_His', '20121206_190301'), $linkDB[2]['updated']); | 368 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_190301'), $linkDB[2]['updated']); |
369 | } | 369 | } |
370 | 370 | ||
371 | /** | 371 | /** |
diff --git a/tests/plugins/PluginIssoTest.php b/tests/plugins/PluginIssoTest.php index ea86a05c..6b7904dd 100644 --- a/tests/plugins/PluginIssoTest.php +++ b/tests/plugins/PluginIssoTest.php | |||
@@ -52,8 +52,9 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase | |||
52 | 'title' => $str, | 52 | 'title' => $str, |
53 | 'links' => array( | 53 | 'links' => array( |
54 | array( | 54 | array( |
55 | 'id' => 12, | ||
55 | 'url' => $str, | 56 | 'url' => $str, |
56 | 'created' => DateTime::createFromFormat('Ymd_His', $date), | 57 | 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date), |
57 | ) | 58 | ) |
58 | ) | 59 | ) |
59 | ); | 60 | ); |
@@ -66,7 +67,14 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase | |||
66 | 67 | ||
67 | // plugin data | 68 | // plugin data |
68 | $this->assertEquals(1, count($data['plugin_end_zone'])); | 69 | $this->assertEquals(1, count($data['plugin_end_zone'])); |
69 | $this->assertNotFalse(strpos($data['plugin_end_zone'][0], $date)); | 70 | $this->assertNotFalse(strpos( |
71 | $data['plugin_end_zone'][0], | ||
72 | 'data-isso-id="'. $data['links'][0]['id'] .'"' | ||
73 | )); | ||
74 | $this->assertNotFalse(strpos( | ||
75 | $data['plugin_end_zone'][0], | ||
76 | 'data-title="'. $data['links'][0]['id'] .'"' | ||
77 | )); | ||
70 | $this->assertNotFalse(strpos($data['plugin_end_zone'][0], 'embed.min.js')); | 78 | $this->assertNotFalse(strpos($data['plugin_end_zone'][0], 'embed.min.js')); |
71 | } | 79 | } |
72 | 80 | ||
@@ -85,12 +93,14 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase | |||
85 | 'title' => $str, | 93 | 'title' => $str, |
86 | 'links' => array( | 94 | 'links' => array( |
87 | array( | 95 | array( |
96 | 'id' => 12, | ||
88 | 'url' => $str, | 97 | 'url' => $str, |
89 | 'created' => DateTime::createFromFormat('Ymd_His', $date1), | 98 | 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date1), |
90 | ), | 99 | ), |
91 | array( | 100 | array( |
101 | 'id' => 13, | ||
92 | 'url' => $str . '2', | 102 | 'url' => $str . '2', |
93 | 'created' => DateTime::createFromFormat('Ymd_His', $date2), | 103 | 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date2), |
94 | ), | 104 | ), |
95 | ) | 105 | ) |
96 | ); | 106 | ); |
@@ -114,8 +124,9 @@ class PluginIssoTest extends PHPUnit_Framework_TestCase | |||
114 | 'title' => $str, | 124 | 'title' => $str, |
115 | 'links' => array( | 125 | 'links' => array( |
116 | array( | 126 | array( |
127 | 'id' => 12, | ||
117 | 'url' => $str, | 128 | 'url' => $str, |
118 | 'created' => DateTime::createFromFormat('Ymd_His', $date), | 129 | 'created' => DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $date), |
119 | ) | 130 | ) |
120 | ), | 131 | ), |
121 | 'search_term' => $str | 132 | 'search_term' => $str |
diff --git a/tests/utils/ReferenceLinkDB.php b/tests/utils/ReferenceLinkDB.php index 6b16c9e8..36d58c68 100644 --- a/tests/utils/ReferenceLinkDB.php +++ b/tests/utils/ReferenceLinkDB.php | |||
@@ -21,7 +21,7 @@ class ReferenceLinkDB | |||
21 | '?WDWyig', | 21 | '?WDWyig', |
22 | 'Stallman has a beard and is part of the Free Software Foundation (or not). Seriously, read this. #hashtag', | 22 | 'Stallman has a beard and is part of the Free Software Foundation (or not). Seriously, read this. #hashtag', |
23 | 0, | 23 | 0, |
24 | DateTime::createFromFormat('Ymd_His', '20150310_114651'), | 24 | DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114651'), |
25 | 'sTuff', | 25 | 'sTuff', |
26 | null, | 26 | null, |
27 | 'WDWyig' | 27 | 'WDWyig' |
@@ -33,7 +33,7 @@ class ReferenceLinkDB | |||
33 | '?WDWyig', | 33 | '?WDWyig', |
34 | 'Used to test links reordering.', | 34 | 'Used to test links reordering.', |
35 | 0, | 35 | 0, |
36 | DateTime::createFromFormat('Ymd_His', '20100310_101010'), | 36 | DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20100310_101010'), |
37 | 'ut' | 37 | 'ut' |
38 | ); | 38 | ); |
39 | 39 | ||
@@ -43,9 +43,9 @@ class ReferenceLinkDB | |||
43 | 'https://static.fsf.org/nosvn/faif-2.0.pdf', | 43 | 'https://static.fsf.org/nosvn/faif-2.0.pdf', |
44 | 'Richard Stallman and the Free Software Revolution. Read this. #hashtag', | 44 | 'Richard Stallman and the Free Software Revolution. Read this. #hashtag', |
45 | 0, | 45 | 0, |
46 | DateTime::createFromFormat('Ymd_His', '20150310_114633'), | 46 | DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20150310_114633'), |
47 | 'free gnu software stallman -exclude stuff hashtag', | 47 | 'free gnu software stallman -exclude stuff hashtag', |
48 | DateTime::createFromFormat('Ymd_His', '20160803_093033') | 48 | DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20160803_093033') |
49 | ); | 49 | ); |
50 | 50 | ||
51 | $this->addLink( | 51 | $this->addLink( |
@@ -54,7 +54,7 @@ class ReferenceLinkDB | |||
54 | 'http://mediagoblin.org/', | 54 | 'http://mediagoblin.org/', |
55 | 'A free software media publishing platform #hashtagOther', | 55 | 'A free software media publishing platform #hashtagOther', |
56 | 0, | 56 | 0, |
57 | DateTime::createFromFormat('Ymd_His', '20130614_184135'), | 57 | DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20130614_184135'), |
58 | 'gnu media web .hidden hashtag', | 58 | 'gnu media web .hidden hashtag', |
59 | null, | 59 | null, |
60 | 'IuWvgA' | 60 | 'IuWvgA' |
@@ -66,7 +66,7 @@ class ReferenceLinkDB | |||
66 | 'https://dvcs.w3.org/hg/markup-validator/summary', | 66 | 'https://dvcs.w3.org/hg/markup-validator/summary', |
67 | 'Mercurial repository for the W3C Validator #private', | 67 | 'Mercurial repository for the W3C Validator #private', |
68 | 1, | 68 | 1, |
69 | DateTime::createFromFormat('Ymd_His', '20141125_084734'), | 69 | DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20141125_084734'), |
70 | 'css html w3c web Mercurial' | 70 | 'css html w3c web Mercurial' |
71 | ); | 71 | ); |
72 | 72 | ||
@@ -76,7 +76,7 @@ class ReferenceLinkDB | |||
76 | 'http://ars.userfriendly.org/cartoons/?id=20121206', | 76 | 'http://ars.userfriendly.org/cartoons/?id=20121206', |
77 | 'Naming conventions... #private', | 77 | 'Naming conventions... #private', |
78 | 0, | 78 | 0, |
79 | DateTime::createFromFormat('Ymd_His', '20121206_142300'), | 79 | DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_142300'), |
80 | 'dev cartoon web' | 80 | 'dev cartoon web' |
81 | ); | 81 | ); |
82 | 82 | ||
@@ -86,7 +86,7 @@ class ReferenceLinkDB | |||
86 | 'http://ars.userfriendly.org/cartoons/?id=20010306', | 86 | 'http://ars.userfriendly.org/cartoons/?id=20010306', |
87 | 'Tropical printing', | 87 | 'Tropical printing', |
88 | 0, | 88 | 0, |
89 | DateTime::createFromFormat('Ymd_His', '20121206_172539'), | 89 | DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_172539'), |
90 | 'samba cartoon web' | 90 | 'samba cartoon web' |
91 | ); | 91 | ); |
92 | 92 | ||
@@ -96,7 +96,7 @@ class ReferenceLinkDB | |||
96 | 'http://geek-and-poke.com/', | 96 | 'http://geek-and-poke.com/', |
97 | '', | 97 | '', |
98 | 1, | 98 | 1, |
99 | DateTime::createFromFormat('Ymd_His', '20121206_182539'), | 99 | DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_182539'), |
100 | 'dev cartoon tag1 tag2 tag3 tag4 ' | 100 | 'dev cartoon tag1 tag2 tag3 tag4 ' |
101 | ); | 101 | ); |
102 | } | 102 | } |
@@ -115,7 +115,7 @@ class ReferenceLinkDB | |||
115 | 'tags' => $tags, | 115 | 'tags' => $tags, |
116 | 'created' => $date, | 116 | 'created' => $date, |
117 | 'updated' => $updated, | 117 | 'updated' => $updated, |
118 | 'shorturl' => $shorturl ? $shorturl : smallHash($date->format('Ymd_His') . $id), | 118 | 'shorturl' => $shorturl ? $shorturl : smallHash($date->format(LinkDB::LINK_DATE_FORMAT) . $id), |
119 | ); | 119 | ); |
120 | $this->_links[$id] = $link; | 120 | $this->_links[$id] = $link; |
121 | 121 | ||