aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/Updater
diff options
context:
space:
mode:
Diffstat (limited to 'tests/Updater')
-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}