summaryrefslogtreecommitdiff
path: root/tests/www/editTest.php
diff options
context:
space:
mode:
authorbretticvs <bsdee@frii.com>2011-05-05 16:24:21 -0600
committerbretticvs <bsdee@frii.com>2011-05-05 16:24:21 -0600
commitfc093a5fe51d35a2991e549e8836cac15dc2888b (patch)
tree3606d2acbcbf1d204ace13d8d610830eb1a8878d /tests/www/editTest.php
parent8be81abfe6193e221afcdc35582d34505797a7b8 (diff)
downloadsemanticscuttle-fc093a5fe51d35a2991e549e8836cac15dc2888b.tar.gz
semanticscuttle-fc093a5fe51d35a2991e549e8836cac15dc2888b.tar.bz2
Moved testDefaultPrivacyEdit() to tests/www/editTest.php.
Moved testDefaultPrivacyImportNetscape() to tests/www/importNetscapeTest.php. Moved testDefaultPrivacyImport() to tests/www/importTest.php. Moved testDefaultPrivacyBookmarksAddMissingTitleMissingPrivacy() to tests/www/bookmarksTest.php. Moved testDefaultPrivacyBookmarksAdd() to tests/www/bookmarksTest.php. Kept testDefaultPrivacyPrivate() in tests/api/PostsAddTest.php. Kept testDefaultPrivacyPublic() in tests/api/PostsAddTest.php.
Diffstat (limited to 'tests/www/editTest.php')
-rwxr-xr-xtests/www/editTest.php48
1 files changed, 48 insertions, 0 deletions
diff --git a/tests/www/editTest.php b/tests/www/editTest.php
new file mode 100755
index 0000000..1e0fbd5
--- /dev/null
+++ b/tests/www/editTest.php
@@ -0,0 +1,48 @@
+<?php
+require_once dirname(__FILE__) . '/../prepare.php';
+require_once 'HTTP/Request2.php';
+
+class www_editTest extends TestBaseApi
+{
+ protected $urlPart = 'api/posts/add';
+
+ /**
+ * Test that the default privacy setting is used when an existing
+ * bookmark is updated with edit.php.
+ */
+ public function testDefaultPrivacyEdit()
+ {
+ $this->setUnittestConfig(
+ array('defaults' => array('privacy' => 2))
+ );
+
+ list($req, $uId) = $this->getLoggedInRequest('?unittestMode=1');
+ $cookies = $req->getCookieJar();
+ $req->setMethod(HTTP_Request2::METHOD_POST);
+ $req->addPostParameter('url', 'http://www.example.org/testdefaultprivacyposts_edit');
+ $req->addPostParameter('description', 'Test bookmark 2 for default privacy.');
+ $req->addPostParameter('status', '0');
+ $res = $req->send();
+ $this->assertEquals(
+ 200, $res->getStatus(),
+ 'Adding bookmark failed: ' . $res->getBody());
+ $bms = $this->bs->getBookmarks(0, null, $uId);
+ $bm = reset($bms['bookmarks']);
+ $bmId = $bm['bId'];
+
+ $reqUrl = $GLOBALS['unittestUrl'] . 'edit.php/' . $bmId . '?unittestMode=1';
+ $req2 = new HTTP_Request2($reqUrl, HTTP_Request2::METHOD_POST);
+ $req2->setCookieJar($cookies);
+ $req2->addPostParameter('address', 'http://www.example.org/testdefaultprivacyposts_edit');
+ $req2->addPostParameter('title', 'Test bookmark 2 for default privacy.');
+ $req2->addPostParameter('submitted', '1');
+ $res = $req2->send();
+
+ $this->assertEquals(302, $res->getStatus(), 'Editing bookmark failed');
+
+ $bm = $this->bs->getBookmark($bmId);
+ $this->assertEquals('2', $bm['bStatus']);
+ }//end testDefaultPrivacyEdit
+
+}//end class www_editTest
+?>