diff options
author | tailor <cygnus@janrain.com> | 2007-04-05 22:09:54 +0000 |
---|---|---|
committer | tailor <cygnus@janrain.com> | 2007-04-05 22:09:54 +0000 |
commit | 152b922337a75cac3ec1614e5e6024e54e92f887 (patch) | |
tree | 73c23d35a35ae0202ed2851d2a63bfd716f3595e | |
parent | 99457203cfe3ac08472e2b332bc25104ee5aa500 (diff) | |
download | php-openid-152b922337a75cac3ec1614e5e6024e54e92f887.zip php-openid-152b922337a75cac3ec1614e5e6024e54e92f887.tar.gz php-openid-152b922337a75cac3ec1614e5e6024e54e92f887.tar.bz2 |
[project @ Add test cases for Auth_OpenID::getQuery]
-rw-r--r-- | Tests/Auth/OpenID/Util.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/Tests/Auth/OpenID/Util.php b/Tests/Auth/OpenID/Util.php index 838a5a6..de60c92 100644 --- a/Tests/Auth/OpenID/Util.php +++ b/Tests/Auth/OpenID/Util.php @@ -255,6 +255,34 @@ assert not should_raise and actual == expected, case Auth_OpenID::appendArgs($url, $query)); } } + + function test_getQuery() + { + $queries = array( + '' => array(), + 'single' => array(), + 'no&pairs' => array(), + 'x%3Dy' => array(), + 'single&real=value' => array('real' => 'value'), + 'x=y&m=x%3Dn' => array('x' => 'y', 'm' => 'x=n'), + '&m=x%20y' => array('m' => 'x y'), + 'single&&m=x%20y&bogus' => array('m' => 'x y'), + // Even with invalid encoding. But don't do that. + 'too=many=equals&' => array('too' => 'many=equals') + ); + + foreach ($queries as $s => $data) { + $query = Auth_OpenID::getQuery($s); + + foreach ($data as $key => $value) { + $this->assertTrue($query[$key] === $value); + } + + foreach ($query as $key => $value) { + $this->assertTrue($data[$key] === $value); + } + } + } } ?> |