logo       
Google Custom Search
    AddThis Social Bookmark Button

cvs: pear-core /tests PEAR_test_mock_pearweb.php.inc download_test_classes.: msg#00344

Subject: cvs: pear-core /tests PEAR_test_mock_pearweb.php.inc download_test_classes.php.inc
cellog          Wed Dec 29 01:20:13 2004 EDT

  Modified files:              
    /pear-core/tests    PEAR_test_mock_pearweb.php.inc 
                        download_test_classes.php.inc 
  Log:
  fix up mock objects
  
http://cvs.php.net/diff.php/pear-core/tests/PEAR_test_mock_pearweb.php.inc?r1=1.7&r2=1.8&ty=u
Index: pear-core/tests/PEAR_test_mock_pearweb.php.inc
diff -u pear-core/tests/PEAR_test_mock_pearweb.php.inc:1.7 
pear-core/tests/PEAR_test_mock_pearweb.php.inc:1.8
--- pear-core/tests/PEAR_test_mock_pearweb.php.inc:1.7  Tue Dec 21 20:49:37 2004
+++ pear-core/tests/PEAR_test_mock_pearweb.php.inc      Wed Dec 29 01:20:13 2004
@@ -84,6 +84,9 @@
                     $result = $this->_remote->parentcall($method, $args[0], 
$args[1], $args[2], $args[3], $args[4], $args[5]);
                 break;
             }
+            if (PEAR::isError($result)) {
+                $result = null;
+            }
             $dump = new PHP_Dump($result);
             $args = new PHP_Dump($args);
             if 
(!isset($this->_pearweb->_config['xmlrpc'][$server][$method][serialize($args)]))
@@ -125,6 +128,9 @@
                     $result = $this->_remote->parentcall($method, $args[0], 
$args[1], $args[2], $args[3], $args[4], $args[5]);
                 break;
             }
+            if (PEAR::isError($result)) {
+                $result = null;
+            }
             $dump = new PHP_Dump($result);
             $args = new PHP_Dump($args);
             if 
(!isset($this->_pearweb->_config['xmlrpc'][$server][$method][serialize($args)]))
http://cvs.php.net/diff.php/pear-core/tests/download_test_classes.php.inc?r1=1.18&r2=1.19&ty=u
Index: pear-core/tests/download_test_classes.php.inc
diff -u pear-core/tests/download_test_classes.php.inc:1.18 
pear-core/tests/download_test_classes.php.inc:1.19
--- pear-core/tests/download_test_classes.php.inc:1.18  Tue Dec 21 20:05:24 2004
+++ pear-core/tests/download_test_classes.php.inc       Wed Dec 29 01:20:13 2004
@@ -73,9 +73,24 @@
         $server_channel = $this->config->get('default_channel');
         $channel = $this->_registry->getChannel($server_channel);
         if ($channel) {
-            if (!$channel->supports('xmlrpc', $method)) {
-                // check for channel.list, which is implicitly supported for 
the PEAR channel
-                return $this->raiseError("Channel $server_channel does not 
support xml-rpc method $method");
+            $mirror = $this->config->get('preferred_mirror');
+            if ($channel->getMirror($mirror)) {
+                if ($channel->supports('xmlrpc', $method, $mirror)) {
+                    $server_channel = $server_host = $mirror; // use the 
preferred mirror
+                    $server_port = $channel->getPort($mirror);
+                } elseif (!$channel->supports('xmlrpc', $method)) {
+                    return $this->raiseError("Channel $server_channel does not 
" .
+                        "support xml-rpc method $method");
+                }
+            }
+            if (!isset($server_host)) {
+                if (!$channel->supports('xmlrpc', $method)) {
+                    return $this->raiseError("Channel $server_channel does not 
support " .
+                        "xml-rpc method $method");
+                } else {
+                    $server_host = $server_channel;
+                    $server_port = $channel->getPort();
+                }
             }
         } else {
             return $this->raiseError("Unknown channel '$server_channel'");
@@ -151,10 +166,33 @@
         if ($this->_fakepearweb) {
             $server_channel = $this->config->get('default_channel');
             $channel = $this->_registry->getChannel($server_channel);
+            if ($channel) {
+                $mirror = $this->config->get('preferred_mirror');
+                if ($channel->getMirror($mirror)) {
+                    if ($channel->supports('xmlrpc', $method, $mirror)) {
+                        $server_channel = $server_host = $mirror; // use the 
preferred mirror
+                        $server_port = $channel->getPort($mirror);
+                    } elseif (!$channel->supports('xmlrpc', $method)) {
+                        return $this->raiseError("Channel $server_channel does 
not " .
+                            "support xml-rpc method $method");
+                    }
+                }
+                if (!isset($server_host)) {
+                    if (!$channel->supports('xmlrpc', $method)) {
+                        return $this->raiseError("Channel $server_channel does 
not support " .
+                            "xml-rpc method $method");
+                    } else {
+                        $server_host = $server_channel;
+                        $server_port = $channel->getPort();
+                    }
+                }
+            } else {
+                return $this->raiseError("Unknown channel '$server_channel'");
+            }
             if (count($args)) {
-                $result = $this->_pearweb->call($channel->getServer(), 
$method, $args);
+                $result = $this->_pearweb->call($server_channel, $method, 
$args);
             } else {
-                $result = $this->_pearweb->call($channel->getServer(), 
$method);
+                $result = $this->_pearweb->call($server_channel, $method);
             }
         }/* else {
             switch (count($args)) {
@@ -770,6 +808,16 @@
         $remote = &new test_PEAR_Remote($this);
         return $remote;
     }
+
+    function &singleton($user_file = '', $system_file = '')
+    {
+        if (is_object($GLOBALS['_PEAR_Config_instance'])) {
+            return $GLOBALS['_PEAR_Config_instance'];
+        }
+        $GLOBALS['_PEAR_Config_instance'] =
+             &new test_PEAR_Config($user_file, $system_file);
+        return $GLOBALS['_PEAR_Config_instance'];
+    }
 }
 
 class fake_log
@@ -807,6 +855,19 @@
         $this->_download = array();
         return $log;
     }
+
+    function setDialogOutput($input, $output)
+    {
+        $this->_dialogInput[var_export($input, true)] = $output;
+    }
+
+    function userDialog()
+    {
+        $input = func_get_args();
+        if (isset($this->_dialogInput[var_export($input, true)])) {
+            return $this->_dialogInput[var_export($input, true)];
+        }
+    }
 }
 
 function cleanall($dir = null)

-- 
PEAR CVS Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php





Try Searching:
servers, voip, java, networking, microsoft ...
<Prev in Thread] Current Thread [Next in Thread>