use cookie jar instead of manually creating the cookie

This commit is contained in:
Christian Weiske 2011-04-26 07:00:33 +02:00
parent 43b6021be7
commit 3e5cadc764

View file

@ -564,6 +564,7 @@ TXT;
array('defaults' => array('privacy' => 2)) array('defaults' => array('privacy' => 2))
); );
list($req, $uId) = $this->getLoggedInRequest(); list($req, $uId) = $this->getLoggedInRequest();
$cookies = $req->getCookieJar();
$req->setMethod(HTTP_Request2::METHOD_POST); $req->setMethod(HTTP_Request2::METHOD_POST);
$req->addPostParameter('url', 'http://www.example.org/testdefaultprivacyposts_bookmarksget'); $req->addPostParameter('url', 'http://www.example.org/testdefaultprivacyposts_bookmarksget');
$req->addPostParameter('description', 'Test bookmark 1 for default privacy.'); $req->addPostParameter('description', 'Test bookmark 1 for default privacy.');
@ -582,13 +583,7 @@ TXT;
list($req, $uId) = $this->getAuthRequest('?unittestMode=1'); list($req, $uId) = $this->getAuthRequest('?unittestMode=1');
$req->setMethod(HTTP_Request2::METHOD_POST); $req->setMethod(HTTP_Request2::METHOD_POST);
$req->setUrl($reqUrl); $req->setUrl($reqUrl);
$testcookiekey = md5($GLOBALS['dbname'].$GLOBALS['tableprefix']).'-login'; $req->setCookieJar($cookies);
$userinfo = $this->us->getUser($oldUid);
$testcookiepassword = $userinfo['password'];
$testusername = $userinfo['username'];
$testcookievalue = $oldUid . ':' . md5($testusername . $testcookiepassword);
$req->setCookieJar(true);
$req->addCookie($testcookiekey, $testcookievalue);
$req->addPostParameter('submitted', '1'); $req->addPostParameter('submitted', '1');
$response = $req->send(); $response = $req->send();
$response_body = $response->getBody(); $response_body = $response->getBody();