fixed pointless initialization of persistent handles lists on cleanup
[m6w6/ext-raphf] / tests / http004.phpt
index 0c47c7b67d1fd958a1baba769e09933fe79ff1c7..0e677f29aaf567ee528dd0f8befe29c727b5da75 100644 (file)
@@ -13,30 +13,34 @@ if (!class_exists("http\\Client", false)) {
 <?php
 echo "Test\n";
 
-var_dump(raphf\stat_persistent_handles());
+$h = (array) raphf\stat_persistent_handles();
+var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
 
-$c = new http\Client("curl", "php.net:80");
-$c2 = new http\Client("curl", "php.net:80");
+$c = new http\Client("curl", "PHP");
+$c2 = new http\Client("curl", "PHP");
 do {
        $c->enqueue(new http\Client\Request("GET", "http://php.net"));
        $c2->enqueue(new http\Client\Request("GET", "http://php.net"));
 } while (count($c) < 3);
 
-var_dump(raphf\stat_persistent_handles());
+$h = (array) raphf\stat_persistent_handles();
+var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
 
 unset($c);
 
-var_dump(raphf\stat_persistent_handles());
+$h = (array) raphf\stat_persistent_handles();
+var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
 
 raphf\clean_persistent_handles();
 
-var_dump(raphf\stat_persistent_handles());
+$h = (array) raphf\stat_persistent_handles();
+var_dump(array_intersect_key($h, array_flip(preg_grep("/^http/", array_keys($h)))));
 
 ?>
 Done
 --EXPECTF--
 Test
-object(stdClass)#%d (2) {
+array(2) {
   ["http\Client\Curl"]=>
   array(0) {
   }
@@ -44,10 +48,10 @@ object(stdClass)#%d (2) {
   array(0) {
   }
 }
-object(stdClass)#%d (2) {
+array(2) {
   ["http\Client\Curl"]=>
   array(1) {
-    ["php.net:80"]=>
+    ["PHP"]=>
     array(2) {
       ["used"]=>
       int(2)
@@ -57,7 +61,7 @@ object(stdClass)#%d (2) {
   }
   ["http\Client\Curl\Request"]=>
   array(1) {
-    ["php.net:80"]=>
+    ["PHP:php.net:80"]=>
     array(2) {
       ["used"]=>
       int(6)
@@ -66,10 +70,10 @@ object(stdClass)#%d (2) {
     }
   }
 }
-object(stdClass)#%d (2) {
+array(2) {
   ["http\Client\Curl"]=>
   array(1) {
-    ["php.net:80"]=>
+    ["PHP"]=>
     array(2) {
       ["used"]=>
       int(1)
@@ -79,7 +83,7 @@ object(stdClass)#%d (2) {
   }
   ["http\Client\Curl\Request"]=>
   array(1) {
-    ["php.net:80"]=>
+    ["PHP:php.net:80"]=>
     array(2) {
       ["used"]=>
       int(3)
@@ -88,10 +92,10 @@ object(stdClass)#%d (2) {
     }
   }
 }
-object(stdClass)#%d (2) {
+array(2) {
   ["http\Client\Curl"]=>
   array(1) {
-    ["php.net:80"]=>
+    ["PHP"]=>
     array(2) {
       ["used"]=>
       int(1)
@@ -101,7 +105,7 @@ object(stdClass)#%d (2) {
   }
   ["http\Client\Curl\Request"]=>
   array(1) {
-    ["php.net:80"]=>
+    ["PHP:php.net:80"]=>
     array(2) {
       ["used"]=>
       int(3)