aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Updater/UpdaterTest.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/Updater/UpdaterTest.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/Updater/UpdaterTest.php')
-rw-r--r--tests/Updater/UpdaterTest.php61
1 files changed, 61 insertions, 0 deletions
diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php
index cacee2d2..870f169a 100644
--- a/tests/Updater/UpdaterTest.php
+++ b/tests/Updater/UpdaterTest.php
@@ -688,6 +688,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
688 } 688 }
689 689
690 /** 690 /**
691<<<<<<< HEAD
691 * Test updateMethodWebThumbnailer with thumbnails enabled. 692 * Test updateMethodWebThumbnailer with thumbnails enabled.
692 */ 693 */
693 public function testUpdateMethodWebThumbnailerEnabled() 694 public function testUpdateMethodWebThumbnailerEnabled()
@@ -732,4 +733,64 @@ $GLOBALS[\'privateLinkByDefault\'] = true;';
732 $this->assertEquals(53, $this->conf->get('thumbnails.height')); 733 $this->assertEquals(53, $this->conf->get('thumbnails.height'));
733 $this->assertTrue(empty($_SESSION['warnings'])); 734 $this->assertTrue(empty($_SESSION['warnings']));
734 } 735 }
736
737 /**
738 * Test updateMethodSetSticky().
739 */
740 public function testUpdateStickyValid()
741 {
742 $blank = [
743 'id' => 1,
744 'url' => 'z',
745 'title' => '',
746 'description' => '',
747 'tags' => '',
748 'created' => new DateTime(),
749 ];
750 $links = [
751 1 => ['id' => 1] + $blank,
752 2 => ['id' => 2] + $blank,
753 ];
754 $refDB = new ReferenceLinkDB();
755 $refDB->setLinks($links);
756 $refDB->write(self::$testDatastore);
757 $linkDB = new LinkDB(self::$testDatastore, true, false);
758
759 $updater = new Updater(array(), $linkDB, $this->conf, true);
760 $this->assertTrue($updater->updateMethodSetSticky());
761
762 $linkDB = new LinkDB(self::$testDatastore, true, false);
763 foreach ($linkDB as $link) {
764 $this->assertFalse($link['sticky']);
765 }
766 }
767
768 /**
769 * Test updateMethodSetSticky().
770 */
771 public function testUpdateStickyNothingToDo()
772 {
773 $blank = [
774 'id' => 1,
775 'url' => 'z',
776 'title' => '',
777 'description' => '',
778 'tags' => '',
779 'created' => new DateTime(),
780 ];
781 $links = [
782 1 => ['id' => 1, 'sticky' => true] + $blank,
783 2 => ['id' => 2] + $blank,
784 ];
785 $refDB = new ReferenceLinkDB();
786 $refDB->setLinks($links);
787 $refDB->write(self::$testDatastore);
788 $linkDB = new LinkDB(self::$testDatastore, true, false);
789
790 $updater = new Updater(array(), $linkDB, $this->conf, true);
791 $this->assertTrue($updater->updateMethodSetSticky());
792
793 $linkDB = new LinkDB(self::$testDatastore, true, false);
794 $this->assertTrue($linkDB[1]['sticky']);
795 }
735} 796}