diff options
author | VirtualTam <virtualtam@flibidi.net> | 2019-02-23 16:27:33 +0100 |
---|---|---|
committer | VirtualTam <virtualtam@flibidi.net> | 2019-02-23 16:27:33 +0100 |
commit | 43c77f658a905e2def6aeca4c092683977cd0c55 (patch) | |
tree | cb0dc273a315a777847d251f856625b2fc779c04 /tests/Updater/UpdaterTest.php | |
parent | 630ebca2b6359e942e5b6c057cca2b6069c1093a (diff) | |
parent | 1826e383ecf501302974132fd443cf1ca06e10f6 (diff) | |
download | Shaarli-43c77f658a905e2def6aeca4c092683977cd0c55.tar.gz Shaarli-43c77f658a905e2def6aeca4c092683977cd0c55.tar.zst Shaarli-43c77f658a905e2def6aeca4c092683977cd0c55.zip |
Merge commit '1826e383ecf501302974132fd443cf1ca06e10f6' into v0.10
Diffstat (limited to 'tests/Updater/UpdaterTest.php')
-rw-r--r-- | tests/Updater/UpdaterTest.php | 81 |
1 files changed, 77 insertions, 4 deletions
diff --git a/tests/Updater/UpdaterTest.php b/tests/Updater/UpdaterTest.php index cacee2d2..c4a6e7ef 100644 --- a/tests/Updater/UpdaterTest.php +++ b/tests/Updater/UpdaterTest.php | |||
@@ -393,20 +393,32 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; | |||
393 | $this->assertEquals('Naming conventions... #private', $linkDB[0]['description']); | 393 | $this->assertEquals('Naming conventions... #private', $linkDB[0]['description']); |
394 | $this->assertEquals('samba cartoon web', $linkDB[0]['tags']); | 394 | $this->assertEquals('samba cartoon web', $linkDB[0]['tags']); |
395 | $this->assertTrue($linkDB[0]['private']); | 395 | $this->assertTrue($linkDB[0]['private']); |
396 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_142300'), $linkDB[0]['created']); | 396 | $this->assertEquals( |
397 | DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_142300'), | ||
398 | $linkDB[0]['created'] | ||
399 | ); | ||
397 | 400 | ||
398 | $this->assertTrue(isset($linkDB[1])); | 401 | $this->assertTrue(isset($linkDB[1])); |
399 | $this->assertFalse(isset($linkDB[1]['linkdate'])); | 402 | $this->assertFalse(isset($linkDB[1]['linkdate'])); |
400 | $this->assertEquals(1, $linkDB[1]['id']); | 403 | $this->assertEquals(1, $linkDB[1]['id']); |
401 | $this->assertEquals('UserFriendly - Samba', $linkDB[1]['title']); | 404 | $this->assertEquals('UserFriendly - Samba', $linkDB[1]['title']); |
402 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_172539'), $linkDB[1]['created']); | 405 | $this->assertEquals( |
406 | DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_172539'), | ||
407 | $linkDB[1]['created'] | ||
408 | ); | ||
403 | 409 | ||
404 | $this->assertTrue(isset($linkDB[2])); | 410 | $this->assertTrue(isset($linkDB[2])); |
405 | $this->assertFalse(isset($linkDB[2]['linkdate'])); | 411 | $this->assertFalse(isset($linkDB[2]['linkdate'])); |
406 | $this->assertEquals(2, $linkDB[2]['id']); | 412 | $this->assertEquals(2, $linkDB[2]['id']); |
407 | $this->assertEquals('Geek and Poke', $linkDB[2]['title']); | 413 | $this->assertEquals('Geek and Poke', $linkDB[2]['title']); |
408 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_182539'), $linkDB[2]['created']); | 414 | $this->assertEquals( |
409 | $this->assertEquals(DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_190301'), $linkDB[2]['updated']); | 415 | DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_182539'), |
416 | $linkDB[2]['created'] | ||
417 | ); | ||
418 | $this->assertEquals( | ||
419 | DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, '20121206_190301'), | ||
420 | $linkDB[2]['updated'] | ||
421 | ); | ||
410 | } | 422 | } |
411 | 423 | ||
412 | /** | 424 | /** |
@@ -688,6 +700,7 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; | |||
688 | } | 700 | } |
689 | 701 | ||
690 | /** | 702 | /** |
703 | <<<<<<< HEAD | ||
691 | * Test updateMethodWebThumbnailer with thumbnails enabled. | 704 | * Test updateMethodWebThumbnailer with thumbnails enabled. |
692 | */ | 705 | */ |
693 | public function testUpdateMethodWebThumbnailerEnabled() | 706 | public function testUpdateMethodWebThumbnailerEnabled() |
@@ -732,4 +745,64 @@ $GLOBALS[\'privateLinkByDefault\'] = true;'; | |||
732 | $this->assertEquals(53, $this->conf->get('thumbnails.height')); | 745 | $this->assertEquals(53, $this->conf->get('thumbnails.height')); |
733 | $this->assertTrue(empty($_SESSION['warnings'])); | 746 | $this->assertTrue(empty($_SESSION['warnings'])); |
734 | } | 747 | } |
748 | |||
749 | /** | ||
750 | * Test updateMethodSetSticky(). | ||
751 | */ | ||
752 | public function testUpdateStickyValid() | ||
753 | { | ||
754 | $blank = [ | ||
755 | 'id' => 1, | ||
756 | 'url' => 'z', | ||
757 | 'title' => '', | ||
758 | 'description' => '', | ||
759 | 'tags' => '', | ||
760 | 'created' => new DateTime(), | ||
761 | ]; | ||
762 | $links = [ | ||
763 | 1 => ['id' => 1] + $blank, | ||
764 | 2 => ['id' => 2] + $blank, | ||
765 | ]; | ||
766 | $refDB = new ReferenceLinkDB(); | ||
767 | $refDB->setLinks($links); | ||
768 | $refDB->write(self::$testDatastore); | ||
769 | $linkDB = new LinkDB(self::$testDatastore, true, false); | ||
770 | |||
771 | $updater = new Updater(array(), $linkDB, $this->conf, true); | ||
772 | $this->assertTrue($updater->updateMethodSetSticky()); | ||
773 | |||
774 | $linkDB = new LinkDB(self::$testDatastore, true, false); | ||
775 | foreach ($linkDB as $link) { | ||
776 | $this->assertFalse($link['sticky']); | ||
777 | } | ||
778 | } | ||
779 | |||
780 | /** | ||
781 | * Test updateMethodSetSticky(). | ||
782 | */ | ||
783 | public function testUpdateStickyNothingToDo() | ||
784 | { | ||
785 | $blank = [ | ||
786 | 'id' => 1, | ||
787 | 'url' => 'z', | ||
788 | 'title' => '', | ||
789 | 'description' => '', | ||
790 | 'tags' => '', | ||
791 | 'created' => new DateTime(), | ||
792 | ]; | ||
793 | $links = [ | ||
794 | 1 => ['id' => 1, 'sticky' => true] + $blank, | ||
795 | 2 => ['id' => 2] + $blank, | ||
796 | ]; | ||
797 | $refDB = new ReferenceLinkDB(); | ||
798 | $refDB->setLinks($links); | ||
799 | $refDB->write(self::$testDatastore); | ||
800 | $linkDB = new LinkDB(self::$testDatastore, true, false); | ||
801 | |||
802 | $updater = new Updater(array(), $linkDB, $this->conf, true); | ||
803 | $this->assertTrue($updater->updateMethodSetSticky()); | ||
804 | |||
805 | $linkDB = new LinkDB(self::$testDatastore, true, false); | ||
806 | $this->assertTrue($linkDB[1]['sticky']); | ||
807 | } | ||
735 | } | 808 | } |