aboutsummaryrefslogtreecommitdiff
path: root/tests/TestBaseApi.php
diff options
context:
space:
mode:
authorcweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2010-03-28 18:06:07 +0000
committercweiske <cweiske@b3834d28-1941-0410-a4f8-b48e95affb8f>2010-03-28 18:06:07 +0000
commita518928796f87ff61e7fcb34d69b374378fdadf6 (patch)
tree691b634d4e8c137f7556cea553c637749cdedcee /tests/TestBaseApi.php
parentccabc1cdfa6605f4454653360ec00dc171368556 (diff)
downloadsemanticscuttle-a518928796f87ff61e7fcb34d69b374378fdadf6.tar.gz
semanticscuttle-a518928796f87ff61e7fcb34d69b374378fdadf6.tar.bz2
add test for api/export_csv.php
git-svn-id: https://semanticscuttle.svn.sourceforge.net/svnroot/semanticscuttle/trunk@700 b3834d28-1941-0410-a4f8-b48e95affb8f
Diffstat (limited to 'tests/TestBaseApi.php')
-rw-r--r--tests/TestBaseApi.php78
1 files changed, 78 insertions, 0 deletions
diff --git a/tests/TestBaseApi.php b/tests/TestBaseApi.php
new file mode 100644
index 0000000..03ca016
--- /dev/null
+++ b/tests/TestBaseApi.php
@@ -0,0 +1,78 @@
+<?php
+/**
+ * SemanticScuttle - your social bookmark manager.
+ *
+ * PHP version 5.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license GPL http://www.gnu.org/licenses/gpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
+
+require_once 'PHPUnit/Framework.php';
+
+PHPUnit_Util_Filter::addFileToFilter(__FILE__);
+
+/**
+ * Base unittest class for web API tests.
+ *
+ * @category Bookmarking
+ * @package SemanticScuttle
+ * @author Christian Weiske <cweiske@cweiske.de>
+ * @license GPL http://www.gnu.org/licenses/gpl.html
+ * @link http://sourceforge.net/projects/semanticscuttle
+ */
+class TestBaseApi extends TestBase
+{
+ protected $url;
+ protected $urlPart = null;
+
+
+
+ protected function setUp()
+ {
+ if ($GLOBALS['unittestUrl'] === null) {
+ $this->assertTrue(false, 'Unittest URL not set in config');
+ }
+ if ($this->urlPart === null) {
+ $this->assertTrue(false, 'Set the urlPart variable');
+ }
+ $this->url = $GLOBALS['unittestUrl'] . $this->urlPart;
+
+ $this->us = SemanticScuttle_Service_Factory::get('User');
+ $this->bs = SemanticScuttle_Service_Factory::get('Bookmark');
+ $this->bs->deleteAll();
+ }
+
+
+
+ /**
+ * Gets a HTTP request object
+ *
+ * @param string $urlSuffix Suffix for the URL
+ * @param boolean $auth If user authentication is needed
+ *
+ * @return HTTP_Request2 HTTP request object
+ */
+ protected function getRequest($urlSuffix = null, $auth = true)
+ {
+ $req = new HTTP_Request2(
+ $this->url . $urlSuffix,
+ HTTP_Request2::METHOD_GET
+ );
+
+ if ($auth) {
+ $this->addUser('testuser', 'testpassword');
+ $req->setAuth(
+ 'testuser', 'testpassword',
+ HTTP_Request2::AUTH_BASIC
+ );
+ }
+
+ return $req;
+ }
+
+}
+?> \ No newline at end of file