summaryrefslogtreecommitdiff
path: root/tests/BookmarkTest.php
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-11-23 19:11:33 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2009-11-23 19:11:33 +0000
commit82b17be34671852feba16d77f75741e124d76073 (patch)
tree2a498d0cdba92fa9b7b0df525f21cfb133f5306a /tests/BookmarkTest.php
parent60fa8fd540a01c0d4379bf1735f828f5c2124f33 (diff)
downloadsemanticscuttle-82b17be34671852feba16d77f75741e124d76073.tar.gz
semanticscuttle-82b17be34671852feba16d77f75741e124d76073.tar.bz2
part of request #2830224: prepare API for short url service
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@570 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'tests/BookmarkTest.php')
-rw-r--r--tests/BookmarkTest.php54
1 files changed, 49 insertions, 5 deletions
diff --git a/tests/BookmarkTest.php b/tests/BookmarkTest.php
index 0b47bc2..741b6bf 100644
--- a/tests/BookmarkTest.php
+++ b/tests/BookmarkTest.php
@@ -69,6 +69,24 @@ class BookmarkTest extends TestBase
$this->vs->deleteAll();
}
+ /**
+ * Tests if adding a bookmark with short url name
+ * saves it in the database.
+ *
+ * @return void
+ */
+ public function testAddBookmarkShort()
+ {
+ $bid = $this->bs->addBookmark(
+ 'http://example.org', 'title', 'desc', 'priv',
+ 0, array(), 'myShortName'
+ );
+ $bm = $this->bs->getBookmark($bid);
+ $this->assertEquals('http://example.org', $bm['bAddress']);
+ $this->assertArrayHasKey('bShort', $bm);
+ $this->assertEquals('myShortName', $bm['bShort']);
+ }
+
public function testHardCharactersInBookmarks()
{
$bs = $this->bs;
@@ -81,7 +99,7 @@ class BookmarkTest extends TestBase
$bid = $bs->addBookmark(
'http://site1.com', $title, $desc, 'note',
0, array($tag1, $tag2),
- null, false, false, $uid
+ null, null, false, false, $uid
);
$bookmarks = $bs->getBookmarks(0, 1);
@@ -108,12 +126,12 @@ class BookmarkTest extends TestBase
$bs->addBookmark(
'http://site1.com', "title", "description", 'note',
- 0, array('tag1'), null, false, false,
+ 0, array('tag1'), null, null, false, false,
$uid
);
$bs->addBookmark(
"http://site1.com", "title2", "description2", 'note',
- 0, array('tag2'), null, false, false,
+ 0, array('tag2'), null, null, false, false,
$uid2
);
@@ -280,7 +298,7 @@ class BookmarkTest extends TestBase
$this->bs->addBookmark(
'http://test', 'test', 'desc', 'note',
2,//private
- array(), null, false, false, $uid
+ array(), null, null, false, false, $uid
);
$this->assertEquals(0, $this->bs->countBookmarks($uid));
$this->assertEquals(0, $this->bs->countBookmarks($uid, 'public'));
@@ -302,7 +320,7 @@ class BookmarkTest extends TestBase
$this->bs->addBookmark(
'http://test', 'test', 'desc', 'note',
1,//shared
- array(), null, false, false, $uid
+ array(), null, null, false, false, $uid
);
$this->assertEquals(0, $this->bs->countBookmarks($uid));
$this->assertEquals(0, $this->bs->countBookmarks($uid, 'public'));
@@ -734,6 +752,32 @@ class BookmarkTest extends TestBase
$this->assertEquals(1, count($bm['tags']));
$this->assertContains('new', $bm['tags']);
}
+
+ /**
+ * Tests if updating a bookmark's short url name
+ * saves it in the database.
+ *
+ * @return void
+ */
+ public function testUpdateBookmarkShort()
+ {
+ $bid = $this->bs->addBookmark(
+ 'http://example.org', 'title', 'desc', 'priv',
+ 0, array(), 'myShortName'
+ );
+ $bm = $this->bs->getBookmark($bid);
+ $this->assertEquals('myShortName', $bm['bShort']);
+
+ $this->assertTrue(
+ $this->bs->updateBookmark(
+ $bid, 'http://example2.org', 'my title', 'desc',
+ 'priv', 0, array(), 'newShortNambb'
+ )
+ );
+ $bm = $this->bs->getBookmark($bid);
+ $this->assertEquals('newShortNambb', $bm['bShort']);
+ }
+
}