- improve internal array handling
[m6w6/ext-http] / tests / ut_HttpUtil.phpt
index 104c41ae32f302affd007e4f701f4e4817bc2eea..6bf6e2e9177004916bc2890ba45b118f1a3b199b 100644 (file)
@@ -24,12 +24,12 @@ class HttpUtilTest extends PHPUnit2_Framework_TestCase
        $this->assertEquals('Thu, 01 Jan 1970 00:00:01 GMT', HttpUtil::date(1));
     }
 
-    function test_buildUri()
+    function test_buildUrl()
     {
        $_SERVER['SERVER_NAME'] = 'www.example.com';
-       $this->assertEquals('http://www.example.com/test.php?foo=bar', HttpUtil::buildUri('/test.php?foo=bar', null, null, 80));
-       $this->assertEquals('https://www.example.com/', HttpUtil::buildUri('/', 'https'));
-       $this->assertEquals('ftp://ftp.example.com/pub', HttpUtil::buildUri('/pub', null, 'ftp.example.com', 21));
+       $this->assertEquals('http://www.example.com/test.php?foo=bar', HttpUtil::buildUrl('/test.php?foo=bar', array('port' => 80)));
+       $this->assertEquals('https://www.example.com/', HttpUtil::buildUrl('/', array('scheme' => 'https')));
+       $this->assertEquals('ftp://ftp.example.com/pub', HttpUtil::buildUrl('/pub', array('host' => 'ftp.example.com', 'port' => 21)));
     }
 
     function test_negotiateLanguage()
@@ -100,9 +100,8 @@ class HttpUtilTest extends PHPUnit2_Framework_TestCase
     function test_zlib()
     {
        if ($support = http_support(HTTP_SUPPORT_ENCODINGS)) {
-               $this->assertEquals(file_get_contents(__FILE__), http_gzdecode(http_gzencode(file_get_contents(__FILE__))));
+               $this->assertEquals(file_get_contents(__FILE__), http_inflate(http_deflate(file_get_contents(__FILE__), HTTP_DEFLATE_TYPE_GZIP)));
                $this->assertEquals(file_get_contents(__FILE__), http_inflate(http_deflate(file_get_contents(__FILE__))));
-               $this->assertEquals(file_get_contents(__FILE__), http_uncompress(http_compress(file_get_contents(__FILE__))));
                } else {
                        $this->assertFalse($support);
                }