From: gggeek Date: Sat, 30 May 2015 09:28:06 +0000 (+0200) Subject: add test for debug messages set into the server by client code X-Git-Tag: 4.0.0-alpha^2~28 X-Git-Url: http://git.onelab.eu/?p=plcapi.git;a=commitdiff_plain;h=3cb8e96d8cab32cb117518cc305b953b358a2651 add test for debug messages set into the server by client code --- diff --git a/demo/server/server.php b/demo/server/server.php index 180a108..f05557a 100644 --- a/demo/server/server.php +++ b/demo/server/server.php @@ -37,6 +37,8 @@ class xmlrpcServerMethodsContainer { /** * Method used to test logging of php warnings generated by user functions. + * @param PhpXmlRpc\Request $req + * @return PhpXmlRpc\Response */ public function phpWarningGenerator($req) { @@ -46,12 +48,22 @@ class xmlrpcServerMethodsContainer /** * Method used to test catching of exceptions in the server. + * @param PhpXmlRpc\Request $req + * @throws Exception */ public function exceptionGenerator($req) { throw new Exception("it's just a test", 1); } + /** + * @param string $msg + */ + public function debugMessageGenerator($msg) + { + PhpXmlRpc\Server::xmlrpc_debugmsg($msg); + } + /** * A PHP version of the state-number server. Send me an integer and i'll sell you a state. * Used to test wrapping of PHP methods into xmlrpc methods. diff --git a/tests/3LocalhostTest.php b/tests/3LocalhostTest.php index a1f7dbf..220878e 100644 --- a/tests/3LocalhostTest.php +++ b/tests/3LocalhostTest.php @@ -852,6 +852,15 @@ And turned it into nylon'; } } + public function testServerComments() + { + $f = new xmlrpcmsg('tests.xmlrpcServerMethodsContainer.debugMessageGenerator', array( + new xmlrpcval('hello world', 'string'), + )); + $r = $this->send($f, 0, true); + $this->assertContains('hello world', $r->raw_data); + } + public function testSendTwiceSameMsg() { $f = new xmlrpcmsg('examples.stringecho', array( diff --git a/tests/4LocalhostMultiTest.php b/tests/4LocalhostMultiTest.php index 9243514..27eaafc 100644 --- a/tests/4LocalhostMultiTest.php +++ b/tests/4LocalhostMultiTest.php @@ -19,7 +19,7 @@ class LocalhostMultiTest extends LocalhostTest */ function _runtests() { - $unsafeMethods = array('testHttps', 'testCatchExceptions', 'testUtf8Method'); + $unsafeMethods = array('testHttps', 'testCatchExceptions', 'testUtf8Method', 'testServerComments'); foreach(get_class_methods('LocalhostTest') as $method) { if(strpos($method, 'test') === 0 && !in_array($method, $unsafeMethods))