aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/LinkDBTest.php
diff options
context:
space:
mode:
authorArthurHoaro <arthur@hoa.ro>2018-10-06 13:22:59 +0200
committerGitHub <noreply@github.com>2018-10-06 13:22:59 +0200
commit86e1bc713fd7fa74d6a17a7687428fa1c6d3c5f2 (patch)
tree4c9b6c8a550b928dc734de5c78d8403f5631e161 /tests/LinkDBTest.php
parent10a7b5cee96a742fbe86edbea977f3c55c92e9aa (diff)
parentd9bf5b31ff9e2d007ddfb7f7756184f0ca9676c8 (diff)
downloadShaarli-86e1bc713fd7fa74d6a17a7687428fa1c6d3c5f2.tar.gz
Shaarli-86e1bc713fd7fa74d6a17a7687428fa1c6d3c5f2.tar.zst
Shaarli-86e1bc713fd7fa74d6a17a7687428fa1c6d3c5f2.zip
Merge pull request #1144 from ArthurHoaro/feature/sticky
Add a button to set links as sticky
Diffstat (limited to 'tests/LinkDBTest.php')
-rw-r--r--tests/LinkDBTest.php10
1 files changed, 6 insertions, 4 deletions
diff --git a/tests/LinkDBTest.php b/tests/LinkDBTest.php
index 3b980878..fcab76f6 100644
--- a/tests/LinkDBTest.php
+++ b/tests/LinkDBTest.php
@@ -239,12 +239,12 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
239 public function testDays() 239 public function testDays()
240 { 240 {
241 $this->assertEquals( 241 $this->assertEquals(
242 array('20100310', '20121206', '20130614', '20150310'), 242 array('20100309', '20100310', '20121206', '20121207', '20130614', '20150310'),
243 self::$publicLinkDB->days() 243 self::$publicLinkDB->days()
244 ); 244 );
245 245
246 $this->assertEquals( 246 $this->assertEquals(
247 array('20100310', '20121206', '20130614', '20141125', '20150310'), 247 array('20100309', '20100310', '20121206', '20121207', '20130614', '20141125', '20150310'),
248 self::$privateLinkDB->days() 248 self::$privateLinkDB->days()
249 ); 249 );
250 } 250 }
@@ -475,13 +475,15 @@ class LinkDBTest extends PHPUnit_Framework_TestCase
475 public function testReorderLinksDesc() 475 public function testReorderLinksDesc()
476 { 476 {
477 self::$privateLinkDB->reorder('ASC'); 477 self::$privateLinkDB->reorder('ASC');
478 $linkIds = array(42, 4, 9, 1, 0, 7, 6, 8, 41); 478 $stickyIds = [11, 10];
479 $standardIds = [42, 4, 9, 1, 0, 7, 6, 8, 41];
480 $linkIds = array_merge($stickyIds, $standardIds);
479 $cpt = 0; 481 $cpt = 0;
480 foreach (self::$privateLinkDB as $key => $value) { 482 foreach (self::$privateLinkDB as $key => $value) {
481 $this->assertEquals($linkIds[$cpt++], $key); 483 $this->assertEquals($linkIds[$cpt++], $key);
482 } 484 }
483 self::$privateLinkDB->reorder('DESC'); 485 self::$privateLinkDB->reorder('DESC');
484 $linkIds = array_reverse($linkIds); 486 $linkIds = array_merge(array_reverse($stickyIds), array_reverse($standardIds));
485 $cpt = 0; 487 $cpt = 0;
486 foreach (self::$privateLinkDB as $key => $value) { 488 foreach (self::$privateLinkDB as $key => $value) {
487 $this->assertEquals($linkIds[$cpt++], $key); 489 $this->assertEquals($linkIds[$cpt++], $key);