diff options
author | tailor <cygnus@janrain.com> | 2007-10-02 21:42:37 +0000 |
---|---|---|
committer | tailor <cygnus@janrain.com> | 2007-10-02 21:42:37 +0000 |
commit | d0e34d4c4ccacdaeb427e9f8575743445d7065d5 (patch) | |
tree | e46cebb8b2e3804a46ee24124ba8fe35b142c587 /Tests | |
parent | 4f13bdc5e3ba9de6079bfef55dd62f39b0ee7c40 (diff) | |
download | php-openid-d0e34d4c4ccacdaeb427e9f8575743445d7065d5.zip php-openid-d0e34d4c4ccacdaeb427e9f8575743445d7065d5.tar.gz php-openid-d0e34d4c4ccacdaeb427e9f8575743445d7065d5.tar.bz2 |
[project @ Add urldefrag implementation]
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/Auth/OpenID/Util.php | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Tests/Auth/OpenID/Util.php b/Tests/Auth/OpenID/Util.php index de60c92..8e7b009 100644 --- a/Tests/Auth/OpenID/Util.php +++ b/Tests/Auth/OpenID/Util.php @@ -74,6 +74,29 @@ class Tests_Auth_OpenID_Util extends PHPUnit_TestCase { } } + function test_urldefrag() + { + $cases = array( + array('http://foo.com', 'http://foo.com'), + array('http://foo.com/', 'http://foo.com/'), + array('http://foo.com/path', 'http://foo.com/path'), + array('http://foo.com/path?query', 'http://foo.com/path?query'), + array('http://foo.com/path?query=v', 'http://foo.com/path?query=v'), + array('http://foo.com/?query=v', 'http://foo.com/?query=v'), + ); + + foreach ($cases as $pair) { + list($orig, $after) = $pair; + list($base, $frag) = Auth_OpenID::urldefrag($orig); + $this->assertEquals($after, $base); + $this->assertEquals($frag, ''); + + list($base, $frag) = Auth_OpenID::urldefrag($orig . "#fragment"); + $this->assertEquals($after, $base); + $this->assertEquals('fragment', $frag); + } + } + function test_normalizeUrl() { $this->assertEquals("http://foo.com/", |