diff options
author | Christian Weiske <cweiske@cweiske.de> | 2011-05-02 18:07:15 +0200 |
---|---|---|
committer | Christian Weiske <cweiske@cweiske.de> | 2011-05-02 18:07:15 +0200 |
commit | 8be81abfe6193e221afcdc35582d34505797a7b8 (patch) | |
tree | 95ae7e30d40596f27875adb2f96a15fc827f9f86 /tests/TestBaseApi.php | |
parent | f629d081ddf52e3cb83ffbfc973a97adc691790c (diff) | |
parent | 40b4674e471f8b0fbdc77a26eec86018e2ab03ea (diff) | |
download | semanticscuttle-8be81abfe6193e221afcdc35582d34505797a7b8.tar.gz semanticscuttle-8be81abfe6193e221afcdc35582d34505797a7b8.tar.bz2 |
merge master
Diffstat (limited to 'tests/TestBaseApi.php')
-rw-r--r-- | tests/TestBaseApi.php | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/tests/TestBaseApi.php b/tests/TestBaseApi.php index 9759db5..23e1812 100644 --- a/tests/TestBaseApi.php +++ b/tests/TestBaseApi.php @@ -11,6 +11,8 @@ * @link http://sourceforge.net/projects/semanticscuttle */ +require_once 'HTTP/Request2.php'; + /** * Base unittest class for web API tests. * @@ -89,7 +91,8 @@ class TestBaseApi extends TestBase * the request object with authentication details, so that * the user is logged in. * - * Only usable for API requests, not "normal" HTTP page requests + * Useful for HTTP API methods only, cannot be used with + * "normal" HTML pages since they do not support HTTP auth. * * @param string $urlSuffix Suffix for the URL * @param mixed $auth If user authentication is needed (true/false) @@ -166,6 +169,25 @@ class TestBaseApi extends TestBase /** + * Verifies that the HTTP response has status code 200 and + * content-type application/json; charset=utf-8 + * + * @param HTTP_Request2_Response $res HTTP Response object + * + * @return void + */ + protected function assertResponseJson200(HTTP_Request2_Response $res) + { + $this->assertEquals(200, $res->getStatus()); + $this->assertEquals( + 'application/json; charset=utf-8', + $res->getHeader('content-type') + ); + } + + + + /** * Writes a special unittest configuration file. * The unittest config file is read when a GET request with unittestMode=1 * is sent, and the user allowed unittestmode in config.php. |