From 50ea70e5e917da063be3918971c0b423e48a0489 Mon Sep 17 00:00:00 2001 From: gggeek Date: Wed, 8 Dec 2021 23:11:26 +0000 Subject: [PATCH] add a few more tests stressing failure scenarios for wrap_xmlrpc_method --- src/Wrapper.php | 3 +-- tests/5ServerTest.php | 15 +++++++++++++++ tests/6HTTPTest.php | 1 + 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/Wrapper.php b/src/Wrapper.php index 15f84ce..5bb956d 100644 --- a/src/Wrapper.php +++ b/src/Wrapper.php @@ -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; } - } /** diff --git a/tests/5ServerTest.php b/tests/5ServerTest.php index 92d8ba9..4deb587 100644 --- a/tests/5ServerTest.php +++ b/tests/5ServerTest.php @@ -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 diff --git a/tests/6HTTPTest.php b/tests/6HTTPTest.php index ea0487b..3a14809 100644 --- a/tests/6HTTPTest.php +++ b/tests/6HTTPTest.php @@ -24,6 +24,7 @@ class HTTPTest extends ServerTest $unsafeMethods = array( 'testCatchExceptions', 'testUtf8Method', 'testServerComments', 'testExoticCharsetsRequests', 'testExoticCharsetsRequests2', 'testExoticCharsetsRequests3', + 'testWrapInexistentUrl', ); $methods = array(); -- 2.43.0