aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/NetscapeBookmarkUtilsTest.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/NetscapeBookmarkUtilsTest.php')
-rw-r--r--tests/NetscapeBookmarkUtilsTest.php38
1 files changed, 34 insertions, 4 deletions
diff --git a/tests/NetscapeBookmarkUtilsTest.php b/tests/NetscapeBookmarkUtilsTest.php
index b7472d92..41e6d84c 100644
--- a/tests/NetscapeBookmarkUtilsTest.php
+++ b/tests/NetscapeBookmarkUtilsTest.php
@@ -39,7 +39,7 @@ class NetscapeBookmarkUtilsTest extends PHPUnit_Framework_TestCase
39 */ 39 */
40 public function testFilterAndFormatInvalid() 40 public function testFilterAndFormatInvalid()
41 { 41 {
42 NetscapeBookmarkUtils::filterAndFormat(self::$linkDb, 'derp'); 42 NetscapeBookmarkUtils::filterAndFormat(self::$linkDb, 'derp', false, '');
43 } 43 }
44 44
45 /** 45 /**
@@ -47,7 +47,7 @@ class NetscapeBookmarkUtilsTest extends PHPUnit_Framework_TestCase
47 */ 47 */
48 public function testFilterAndFormatAll() 48 public function testFilterAndFormatAll()
49 { 49 {
50 $links = NetscapeBookmarkUtils::filterAndFormat(self::$linkDb, 'all'); 50 $links = NetscapeBookmarkUtils::filterAndFormat(self::$linkDb, 'all', false, '');
51 $this->assertEquals(self::$refDb->countLinks(), sizeof($links)); 51 $this->assertEquals(self::$refDb->countLinks(), sizeof($links));
52 foreach ($links as $link) { 52 foreach ($links as $link) {
53 $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']); 53 $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']);
@@ -67,7 +67,7 @@ class NetscapeBookmarkUtilsTest extends PHPUnit_Framework_TestCase
67 */ 67 */
68 public function testFilterAndFormatPrivate() 68 public function testFilterAndFormatPrivate()
69 { 69 {
70 $links = NetscapeBookmarkUtils::filterAndFormat(self::$linkDb, 'private'); 70 $links = NetscapeBookmarkUtils::filterAndFormat(self::$linkDb, 'private', false, '');
71 $this->assertEquals(self::$refDb->countPrivateLinks(), sizeof($links)); 71 $this->assertEquals(self::$refDb->countPrivateLinks(), sizeof($links));
72 foreach ($links as $link) { 72 foreach ($links as $link) {
73 $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']); 73 $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']);
@@ -87,7 +87,7 @@ class NetscapeBookmarkUtilsTest extends PHPUnit_Framework_TestCase
87 */ 87 */
88 public function testFilterAndFormatPublic() 88 public function testFilterAndFormatPublic()
89 { 89 {
90 $links = NetscapeBookmarkUtils::filterAndFormat(self::$linkDb, 'public'); 90 $links = NetscapeBookmarkUtils::filterAndFormat(self::$linkDb, 'public', false, '');
91 $this->assertEquals(self::$refDb->countPublicLinks(), sizeof($links)); 91 $this->assertEquals(self::$refDb->countPublicLinks(), sizeof($links));
92 foreach ($links as $link) { 92 foreach ($links as $link) {
93 $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']); 93 $date = DateTime::createFromFormat(LinkDB::LINK_DATE_FORMAT, $link['linkdate']);
@@ -101,4 +101,34 @@ class NetscapeBookmarkUtilsTest extends PHPUnit_Framework_TestCase
101 ); 101 );
102 } 102 }
103 } 103 }
104
105 /**
106 * Do not prepend notes with the Shaarli index's URL
107 */
108 public function testFilterAndFormatDoNotPrependNoteUrl()
109 {
110 $links = NetscapeBookmarkUtils::filterAndFormat(self::$linkDb, 'public', false, '');
111 $this->assertEquals(
112 '?WDWyig',
113 $links[0]['url']
114 );
115 }
116
117 /**
118 * Prepend notes with the Shaarli index's URL
119 */
120 public function testFilterAndFormatPrependNoteUrl()
121 {
122 $indexUrl = 'http://localhost:7469/shaarli/';
123 $links = NetscapeBookmarkUtils::filterAndFormat(
124 self::$linkDb,
125 'public',
126 true,
127 $indexUrl
128 );
129 $this->assertEquals(
130 $indexUrl . '?WDWyig',
131 $links[0]['url']
132 );
133 }
104} 134}