diff options
author | Christian Weiske <cweiske@cweiske.de> | 2011-03-26 17:04:00 +0100 |
---|---|---|
committer | Christian Weiske <cweiske@cweiske.de> | 2011-03-26 17:04:00 +0100 |
commit | a756799ef4df0449244d41c2ecc7133c3fb8ce70 (patch) | |
tree | cec5679b67a6997da37bd1593903fe29891ffc78 /tests/ajax | |
parent | 361c18469af5f6782e622420797c4acd5fa70b97 (diff) | |
download | semanticscuttle-a756799ef4df0449244d41c2ecc7133c3fb8ce70.tar.gz semanticscuttle-a756799ef4df0449244d41c2ecc7133c3fb8ce70.tar.bz2 |
move setUnittestConfig to TestBaseApi since it makes only sense to use it there
Diffstat (limited to 'tests/ajax')
-rw-r--r-- | tests/ajax/GetAdminTagsTest.php | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/tests/ajax/GetAdminTagsTest.php b/tests/ajax/GetAdminTagsTest.php new file mode 100644 index 0000000..5c941e8 --- /dev/null +++ b/tests/ajax/GetAdminTagsTest.php @@ -0,0 +1,63 @@ +<?php +/** + * SemanticScuttle - your social bookmark manager. + * + * PHP version 5. + * + * @category Bookmarking + * @package SemanticScuttle + * @author Benjamin Huynh-Kim-Bang <mensonge@users.sourceforge.net> + * @author Christian Weiske <cweiske@cweiske.de> + * @author Eric Dane <ericdane@users.sourceforge.net> + * @license GPL http://www.gnu.org/licenses/gpl.html + * @link http://sourceforge.net/projects/semanticscuttle + */ + +require_once dirname(__FILE__) . '/../prepare.php'; +require_once 'HTTP/Request2.php'; + +/** + * Unit tests for the ajax getadmintags.php script + * + * @category Bookmarking + * @package SemanticScuttle + * @author Christian Weiske <cweiske@cweiske.de> + * @license GPL http://www.gnu.org/licenses/gpl.html + * @link http://sourceforge.net/projects/semanticscuttle + */ +class ajax_GetAdminTagsTest extends TestBaseApi +{ + protected $urlPart = 'ajax/getadmintags.php'; + + + public function testTags() + { + list($user1, $uname1) = $this->addUserData(); + $user2 = $this->addUser(); + $this->addBookmark($user1, null, 0, array('admintag', 'admintag2')); + $this->addBookmark($user2, null, 0, array('lusertag', 'lusertag2')); + + $this->setUnittestConfig( + array( + 'admin_users' => array($uname1) + ) + ); + + $req = $this->getRequest('?unittestMode=1'); + $res = $req->send(); + $this->assertEquals(200, $res->getStatus()); + $this->assertEquals( + 'application/json; charset=utf-8', + $res->getHeader('content-type') + ); + $data = json_decode($res->getBody()); + $this->assertInternalType('array', $data); + $this->assertEquals(2, count($data)); + $this->assertContains('admintag', $data); + $this->assertContains('admintag2', $data); + } + +} + + +?>
\ No newline at end of file |