diff options
author | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-10-25 19:32:48 +0000 |
---|---|---|
committer | cweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f> | 2009-10-25 19:32:48 +0000 |
commit | 09fffebffe9ab1cf7622aa141150157b0746e20d (patch) | |
tree | af3767fbc293d64c56c7dcf54c584b72cca8195f /tests/TestBase.php | |
parent | b38d876fad5d2ba080a87f9667dea4a3a1cca7f5 (diff) | |
download | semanticscuttle-09fffebffe9ab1cf7622aa141150157b0746e20d.tar.gz semanticscuttle-09fffebffe9ab1cf7622aa141150157b0746e20d.tar.bz2 |
test if deleting bookmarks works. to do this, we need a new testbase method to create users, plus we need to return the uid when creating a new user. registration process needs to be adopted to that.
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@417 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'tests/TestBase.php')
-rw-r--r-- | tests/TestBase.php | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/tests/TestBase.php b/tests/TestBase.php index dc5643f..f9946e2 100644 --- a/tests/TestBase.php +++ b/tests/TestBase.php @@ -27,23 +27,50 @@ class TestBase extends PHPUnit_Framework_TestCase /** * Create a new bookmark. * + * @param integer $user User ID the bookmark shall belong + * * @return integer ID of bookmark */ - protected function addBookmark() + protected function addBookmark($user = null) { - $bs = SemanticScuttle_Service_Factory::get('Bookmark'); + if ($user === null) { + $user = $this->addUser(); + } + + $bs = SemanticScuttle_Service_Factory::get('Bookmark'); $rand = rand(); - $bid = $bs->addBookmark( + $bid = $bs->addBookmark( 'http://example.org/' . $rand, 'unittest bookmark #' . $rand, 'description', null, 0, - array('unittest') + array('unittest'), + null, false, false, + $user ); return $bid; } + + + /** + * Creates a new user in the database. + * + * @return integer ID of user + */ + protected function addUser() + { + $us = SemanticScuttle_Service_Factory::get('User'); + $rand = rand(); + $uid = $us->addUser( + 'unittestuser-' . $rand, + $rand, + 'unittest-' . $rand . '@example.org' + ); + return $uid; + } + } ?>
\ No newline at end of file |