From f9e0714350cbb8efdfeac632fe2211c6c59bdbae Mon Sep 17 00:00:00 2001 From: cweiske Date: Wed, 17 Mar 2010 20:05:43 +0000 Subject: [PATCH] write failing test for bug #2953732 git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@687 b3834d28-1941-0410-a4f8-b48e95affb8f --- tests/BookmarkTest.php | 44 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/tests/BookmarkTest.php b/tests/BookmarkTest.php index 74685c4..7885876 100644 --- a/tests/BookmarkTest.php +++ b/tests/BookmarkTest.php @@ -859,6 +859,50 @@ class BookmarkTest extends TestBase + /** + * Tests if getBookmarkByAddress() works correctly. + * + * @return void + */ + public function testGetBookmarkByAddress() + { + $url = 'http://example.org'; + $uid = $this->addUser(); + $bid = $this->addBookmark($uid, $url); + + $bm = $this->bs->getBookmarkByAddress($url); + $this->assertType('array', $bm); + $this->assertEquals($url, $bm['bAddress']); + } + + + + /** + * Tests if getBookmarkByAddress() works correctly with aliases. + * When passing an incomplete address i.e. without protocol, + * the full URL needs to be searched for. + * + * The failure of this test lead to #2953732. + * + * @return void + * + * @link https://sourceforge.net/tracker/?func=detail&atid=1017430&aid=2953732&group_id=211356 + */ + public function testGetBookmarkByAddressAlias() + { + $url = 'http://example.org'; + $incomplete = 'example.org'; + + $uid = $this->addUser(); + $bid = $this->addBookmark($uid, $url); + + $bm = $this->bs->getBookmarkByAddress($incomplete); + $this->assertType('array', $bm); + $this->assertEquals($url, $bm['bAddress']); + } + + + public function testNormalize() { $this->assertEquals(