diff options
author | Yalçın Can <ylcncn@gmail.com> | 2011-07-27 14:23:37 +0300 |
---|---|---|
committer | Yalçın Can <ylcncn@gmail.com> | 2011-07-27 14:23:37 +0300 |
commit | efd842174fdd37f8eb2c460c7adb21954bcfbe9d (patch) | |
tree | a2ab3cc25db92b901b69ce1bc0ad1dedb5d498ef /tests/www/indexTest.php | |
parent | 8cd40b3d76e191b2fbe95b044f69aed07cc27664 (diff) | |
parent | 81aa17b8523d95310c90366d9af09767db0c84f2 (diff) | |
download | semanticscuttle-efd842174fdd37f8eb2c460c7adb21954bcfbe9d.tar.gz semanticscuttle-efd842174fdd37f8eb2c460c7adb21954bcfbe9d.tar.bz2 |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'tests/www/indexTest.php')
-rw-r--r-- | tests/www/indexTest.php | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/www/indexTest.php b/tests/www/indexTest.php new file mode 100644 index 0000000..503fd1f --- /dev/null +++ b/tests/www/indexTest.php @@ -0,0 +1,58 @@ +<?php +require_once dirname(__FILE__) . '/../prepare.php'; +require_once 'HTTP/Request2.php'; + +class www_indexTest extends TestBaseApi +{ + protected $urlPart = ''; + + /** + * Test that the private rss feed exists when user is setup + * with a private key and is enabled + */ + public function testVerifyPrivateRSSLinkExists() + { + list($req, $uId) = $this->getLoggedInRequest('?unittestMode=1', true, true); + + $user = $this->us->getUser($uId); + $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(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 the private key is not enabled + */ + public function testVerifyPrivateRSSLinkDoesNotExist() + { + list($req, $uId) = $this->getLoggedInRequest('?unittestMode=1', true); + + $user = $this->us->getUser($uId); + $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 +?> |