00001 <?php 00008 class UTUrl extends foUnitTestBase 00009 { 00010 public function doTest() 00011 { 00012 $this->testAbsUrl(); 00013 00014 } 00015 00016 function testAbsUrl() 00017 { 00018 $test = array 00019 ( 00020 "g:h" => "g:h", 00021 "g" => "http://a/b/c/g", 00022 "./g" => "http://a/b/c/g", 00023 "g/" => "http://a/b/c/g/", 00024 "/g" => "http://a/g", 00025 "?y" => "http://a/b/c/d;p?y", 00026 "g?y" => "http://a/b/c/g?y", 00027 "#s" => "http://a/b/c/d;p?q#s", 00028 "g#s" => "http://a/b/c/g#s", 00029 "g?y#s" => "http://a/b/c/g?y#s", 00030 ";x" => "http://a/b/c/;x", 00031 "g;x" => "http://a/b/c/g;x", 00032 "g;x?y#s" => "http://a/b/c/g;x?y#s", 00033 "" => "http://a/b/c/d;p?q", 00034 "." => "http://a/b/c/", 00035 "./" => "http://a/b/c/", 00036 ".." => "http://a/b/", 00037 "../" => "http://a/b/", 00038 "../g" => "http://a/b/g", 00039 "../.." => "http://a/", 00040 "../../" => "http://a/", 00041 "../../g" => "http://a/g", 00042 "../../../g" => "http://a/g", 00043 "../../../../g" => "http://a/g", 00044 "/./g" => "http://a/g", 00045 "/../g" => "http://a/g", 00046 "g." => "http://a/b/c/g.", 00047 ".g" => "http://a/b/c/.g", 00048 "g.." => "http://a/b/c/g..", 00049 "..g" => "http://a/b/c/..g", 00050 "./../g" => "http://a/b/g", 00051 "./g/." => "http://a/b/c/g/", 00052 "g/./h" => "http://a/b/c/g/h", 00053 "g/../h" => "http://a/b/c/h", 00054 "g;x=1/./y" => "http://a/b/c/g;x=1/y", 00055 "g;x=1/../y" => "http://a/b/c/y", 00056 "g?y/./x" => "http://a/b/c/g?y/./x", 00057 "g?y/../x" => "http://a/b/c/g?y/../x", 00058 "g#s/./x" => "http://a/b/c/g#s/./x", 00059 "g#s/../x" => "http://a/b/c/g#s/../x", 00060 ); 00061 00062 $this->setSectionLabel('absurl'); 00063 00064 foreach ($test as $key=>$value) 00065 { 00066 eval($this->needEqual('url::absUrl("http://a/b/c/d;p?q", "' . $key .'")', '$value')); 00067 } 00068 00069 eval($this->needEqual('url::absUrl("http://cybercow.se/php/ex/absurl/index.php?moo=aa", "../error/index.php")', '"http://cybercow.se/php/ex/error/index.php"')); 00070 } 00071 } 00072 00073 ?>