diff options
Diffstat (limited to 'tests/LinkDBTest.php')
-rw-r--r-- | tests/LinkDBTest.php | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/tests/LinkDBTest.php b/tests/LinkDBTest.php index 3b980878..c763c0cb 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 | } |
@@ -362,7 +362,7 @@ class LinkDBTest extends PHPUnit_Framework_TestCase | |||
362 | public function testLinkRealUrlWithoutRedirector() | 362 | public function testLinkRealUrlWithoutRedirector() |
363 | { | 363 | { |
364 | $db = new LinkDB(self::$testDatastore, false, false); | 364 | $db = new LinkDB(self::$testDatastore, false, false); |
365 | foreach($db as $link) { | 365 | foreach ($db as $link) { |
366 | $this->assertEquals($link['url'], $link['real_url']); | 366 | $this->assertEquals($link['url'], $link['real_url']); |
367 | } | 367 | } |
368 | } | 368 | } |
@@ -374,13 +374,13 @@ class LinkDBTest extends PHPUnit_Framework_TestCase | |||
374 | { | 374 | { |
375 | $redirector = 'http://redirector.to?'; | 375 | $redirector = 'http://redirector.to?'; |
376 | $db = new LinkDB(self::$testDatastore, false, false, $redirector); | 376 | $db = new LinkDB(self::$testDatastore, false, false, $redirector); |
377 | foreach($db as $link) { | 377 | foreach ($db as $link) { |
378 | $this->assertStringStartsWith($redirector, $link['real_url']); | 378 | $this->assertStringStartsWith($redirector, $link['real_url']); |
379 | $this->assertNotFalse(strpos($link['real_url'], urlencode('://'))); | 379 | $this->assertNotFalse(strpos($link['real_url'], urlencode('://'))); |
380 | } | 380 | } |
381 | 381 | ||
382 | $db = new LinkDB(self::$testDatastore, false, false, $redirector, false); | 382 | $db = new LinkDB(self::$testDatastore, false, false, $redirector, false); |
383 | foreach($db as $link) { | 383 | foreach ($db as $link) { |
384 | $this->assertStringStartsWith($redirector, $link['real_url']); | 384 | $this->assertStringStartsWith($redirector, $link['real_url']); |
385 | $this->assertFalse(strpos($link['real_url'], urlencode('://'))); | 385 | $this->assertFalse(strpos($link['real_url'], urlencode('://'))); |
386 | } | 386 | } |
@@ -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); |