Skip to content

Commit

Permalink
new test for serialize, fix urlencoding of stuff that needs urlencoding
Browse files Browse the repository at this point in the history
  • Loading branch information
Greg Beaver authored and Greg Beaver committed Jul 28, 2011
1 parent f0dd303 commit 6ce41aa
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Pyrus/JsonSchema/URI.php
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ function utfCharToNumber($char) // from PHP manual comments on ord()
function pctEncChar($matches)
{
$chr = $matches[0];
$c = $this->utfCharToNumber(dechex($chr[0]));
$c = $this->utfCharToNumber($chr);

if ($c < 128) {
return "%" . strtoupper(dechex($c));
Expand Down
18 changes: 18 additions & 0 deletions tests/Pyrus/JsonSchema/URI/uri_serialize.phpt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
--TEST--
JsonSchema: URI - serialize
--FILE--
<?php
require dirname(__FILE__) . '/setup.php.inc';
$components = new Pyrus\JsonSchema\URI\Components;
$components->scheme = '%http';
$components->userinfo = 'babyface:boo';
$components->host = 'far.example.com';
$components->port = '8080';
$components->path = '/hi.my.thingy/./there';
$components->query = 'my=1&there=there';
$components->fragment = '#';
$test->assertEquals('http://babyface:[email protected]/hi.my.thingy/there?my=1&there=there#%23', $uri->serialize($components), 'serialize');
?>
===DONE===
--EXPECT--
===DONE===

0 comments on commit 6ce41aa

Please sign in to comment.