aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/LinkDBTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2016-11-28 18:24:15 +0100
committerArthurHoaro <arthur@hoa.ro>2016-12-12 03:03:12 +0100
commitd592daea8343bb4dfecff5d97e93699581ccc58c (patch)
treed508b902b3aba45795fafe16e0b921ac5ea7c4c4 /tests/LinkDBTest.php
parentc3dfd8995921083ff7250c25d0b6ab1184b91aff (diff)
downloadShaarli-d592daea8343bb4dfecff5d97e93699581ccc58c.tar.gz
Shaarli-d592daea8343bb4dfecff5d97e93699581ccc58c.tar.zst
Shaarli-d592daea8343bb4dfecff5d97e93699581ccc58c.zip
Add a persistent 'shorturl' key to all links
All existing link will keep their permalinks. New links will have smallhash generated with date+id. The purpose of this is to avoid collision between links due to their creation date.
Diffstat (limited to 'tests/LinkDBTest.php')
-rw-r--r--tests/LinkDBTest.php22
1 files changed, 11 insertions, 11 deletions
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}