summaryrefslogtreecommitdiffstatshomepage
path: root/tests/www/editTest.php
diff options
context:
space:
mode:
authorGravatar Christian Weiske2011-05-13 06:57:54 +0200
committerGravatar Christian Weiske2011-05-13 06:57:54 +0200
commit803b83fb7d051593066b5224a59fbf3ec6efc824 (patch)
tree173c97393f9e211b05f8c73793c180a1b88799b0 /tests/www/editTest.php
parentfbfbd8d5cae579058b5d31b97c062cefd9bb36b6 (diff)
parent88d7b9631b444cef28115fb8e0bae736b45e557e (diff)
downloadscuttle-803b83fb7d051593066b5224a59fbf3ec6efc824.tar.gz
scuttle-803b83fb7d051593066b5224a59fbf3ec6efc824.zip
Merge branch 'master' into ssl-client-certs
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
+?>