add a few more tests stressing failure scenarios for wrap_xmlrpc_method
authorgggeek <giunta.gaetano@gmail.com>
Wed, 8 Dec 2021 23:11:26 +0000 (23:11 +0000)
committergggeek <giunta.gaetano@gmail.com>
Wed, 8 Dec 2021 23:11:26 +0000 (23:11 +0000)
src/Wrapper.php
tests/5ServerTest.php
tests/6HTTPTest.php

index 15f84ce..5bb956d 100644 (file)
@@ -581,7 +581,7 @@ class Wrapper
         }
 
         // since we are building source code for later use, if we are given an object instance,
-        // we go out of our way and store a pointer to it in a static class var var...
+        // we go out of our way and store a pointer to it in a static class var...
         if (is_array($callable) && is_object($callable[0])) {
             self::$objHolder[$newFuncName] = $callable[0];
             $innerCode .= "\$obj = PhpXmlRpc\\Wrapper::\$objHolder['$newFuncName'];\n";
@@ -733,7 +733,6 @@ class Wrapper
 
             return $results;
         }
-
     }
 
     /**
index 92d8ba9..4deb587 100644 (file)
@@ -826,6 +826,21 @@ And turned it into nylon';
         $this->assertEquals('Michigan', $v->scalarval());
     }
 
+    public function testWrapInexistentMethod()
+    {
+        // make a 'deep client copy' as the original one might have many properties set
+        $func = wrap_xmlrpc_method($this->client, 'examples.getStateName.notexisting', array('simple_client_copy' => 0));
+        $this->assertEquals(false, $func);
+    }
+
+    public function testWrapInexistentUrl()
+    {
+        $this->client->path = '/notexisting';
+        // make a 'deep client copy' as the original one might have many properties set
+        $func = wrap_xmlrpc_method($this->client, 'examples.getStateName', array('simple_client_copy' => 0));
+        $this->assertEquals(false, $func);
+    }
+
     public function testWrappedMethod()
     {
         // make a 'deep client copy' as the original one might have many properties set
index ea0487b..3a14809 100644 (file)
@@ -24,6 +24,7 @@ class HTTPTest extends ServerTest
         $unsafeMethods = array(
             'testCatchExceptions', 'testUtf8Method', 'testServerComments',
             'testExoticCharsetsRequests', 'testExoticCharsetsRequests2', 'testExoticCharsetsRequests3',
+            'testWrapInexistentUrl',
         );
 
         $methods = array();