diff options
author | Mark Pemberton <mpemberton5@gmail.com> | 2011-06-07 22:13:50 -0400 |
---|---|---|
committer | Mark Pemberton <mpemberton5@gmail.com> | 2011-06-07 22:13:50 -0400 |
commit | cd2756a4d0d18497648deacfb619e227335648ad (patch) | |
tree | 899f237603477d2ff1bb5e59eb26daabd9104046 /tests/www/bookmarksTest.php | |
parent | 032ea9ec2582be96527defe65091c6209905ce5a (diff) | |
download | semanticscuttle-cd2756a4d0d18497648deacfb619e227335648ad.tar.gz semanticscuttle-cd2756a4d0d18497648deacfb619e227335648ad.tar.bz2 |
Refined bookmarksTest.php and added indexTest.php
Diffstat (limited to 'tests/www/bookmarksTest.php')
-rwxr-xr-x | tests/www/bookmarksTest.php | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/tests/www/bookmarksTest.php b/tests/www/bookmarksTest.php index eaf78bf..1f6d1a5 100755 --- a/tests/www/bookmarksTest.php +++ b/tests/www/bookmarksTest.php @@ -98,10 +98,37 @@ class www_bookmarksTest extends TestBaseApi $ns = $x->getDocNamespaces(); $x->registerXPathNamespace('ns', reset($ns)); - $elements = $x->xpath('//ns:link'); - $this->assertEquals(5, count($elements), 'Number of Links in Head not correct'); - $this->assertContains('privatekey=', (string)$elements[4]['href']); + $elements = $x->xpath('//ns:link[@rel="alternate" and @type="application/rss+xml"]'); + $this->assertEquals(2, count($elements), 'Number of Links in Head not correct'); + $this->assertContains('privatekey=', (string)$elements[1]['href']); }//end testVerifyPrivateRSSLinkExists + + /** + * Test that the private RSS link doesn't exists when a user + * does not have a private key or is not enabled + */ + public function testVerifyPrivateRSSLinkDoesNotExist() + { + list($req, $uId) = $this->getLoggedInRequest('?unittestMode=1', true); + + $user = $this->us->getUser($uId); + $reqUrl = $GLOBALS['unittestUrl'] . 'bookmarks.php/' + . $user['username']; + $req->setUrl($reqUrl); + $req->setMethod(HTTP_Request2::METHOD_GET); + $response = $req->send(); + $response_body = $response->getBody(); + $this->assertNotEquals('', $response_body, 'Response is empty'); + + $x = simplexml_load_string($response_body); + $ns = $x->getDocNamespaces(); + $x->registerXPathNamespace('ns', reset($ns)); + + $elements = $x->xpath('//ns:link[@rel="alternate" and @type="application/rss+xml"]'); + $this->assertEquals(1, count($elements), 'Number of Links in Head not correct'); + $this->assertNotContains('privatekey=', (string)$elements[0]['href']); + }//end testVerifyPrivateRSSLinkDoesNotExist + }//end class www_bookmarksTest ?> |