two fixes for 'load method synopsis' action in the debugger; add tests for NIL values...
[plcapi.git] / tests / 3LocalhostTest.php
index 4b721d6..a1f7dbf 100644 (file)
@@ -112,6 +112,12 @@ class LocalhostTest extends PHPUnit_Framework_TestCase
         }
     }
 
+    /**
+     * @param PhpXmlRpc\Request|array $msg
+     * @param int|array $errorCode
+     * @param bool $returnResponse
+     * @return mixed|\PhpXmlRpc\Response|\PhpXmlRpc\Response[]|\PhpXmlRpc\Value|string|void
+     */
     protected function send($msg, $errorCode = 0, $returnResponse = false)
     {
         if ($this->collectCodeCoverageInformation) {
@@ -546,6 +552,30 @@ And turned it into nylon';
         $v = $this->send($f);
     }
 
+    public function testNullParams()
+    {
+        $f = new xmlrpcmsg('tests.getStateName.12', array(
+            new xmlrpcval('whatever', 'null'),
+            new xmlrpcval(23, 'int'),
+        ));
+        $v = $this->send($f);
+        if ($v) {
+            $this->assertEquals('Michigan', $v->scalarval());
+        }
+        $f = new xmlrpcmsg('tests.getStateName.12', array(
+            new xmlrpcval(23, 'int'),
+            new xmlrpcval('whatever', 'null'),
+        ));
+        $v = $this->send($f);
+        if ($v) {
+            $this->assertEquals('Michigan', $v->scalarval());
+        }
+        $f = new xmlrpcmsg('tests.getStateName.12', array(
+            new xmlrpcval(23, 'int')
+        ));
+        $v = $this->send($f, array($GLOBALS['xmlrpcerr']['incorrect_params']));
+    }
+
     public function testCodeInjectionServerSide()
     {
         $f = new xmlrpcmsg('system.MethodHelp');