summaryrefslogtreecommitdiffstatshomepage
path: root/tests/TestBase.php
diff options
context:
space:
mode:
Diffstat (limited to 'tests/TestBase.php')
-rw-r--r--tests/TestBase.php35
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