From: gggeek <giunta.gaetano@gmail.com>
Date: Wed, 25 Jan 2023 16:27:48 +0000 (+0000)
Subject: tests
X-Git-Tag: 4.10.0~77
X-Git-Url: http://git.onelab.eu/?a=commitdiff_plain;h=02b7f45d24e026dd832abe0bea37621b7bee953a;p=plcapi.git

tests
---

diff --git a/tests/02ValueTest.php b/tests/02ValueTest.php
index 82a42959..ffd8b1d6 100644
--- a/tests/02ValueTest.php
+++ b/tests/02ValueTest.php
@@ -13,7 +13,7 @@ use PHPUnit\Runner\BaseTestRunner;
  * Tests involving the Value class.
  * NB: these tests do not involve the parsing of xml into Value objects - look in 03ParsingTest for that
  */
-class ValueTests extends PhpXmlRpc_PolyfillTestCase
+class ValueTest extends PhpXmlRpc_PolyfillTestCase
 {
     public $args = array();
 
diff --git a/tests/03MessagesTest.php b/tests/03MessagesTest.php
new file mode 100644
index 00000000..b6c4a3fa
--- /dev/null
+++ b/tests/03MessagesTest.php
@@ -0,0 +1,46 @@
+<?php
+
+include_once __DIR__ . '/../lib/xmlrpc.inc';
+include_once __DIR__ . '/../lib/xmlrpcs.inc';
+
+include_once __DIR__ . '/parse_args.php';
+
+include_once __DIR__ . '/PolyfillTestCase.php';
+
+use PHPUnit\Runner\BaseTestRunner;
+
+/**
+ * Tests involving Requests and Responses, except for the parsing part
+ */
+class MessagesTest extends PhpXmlRpc_PolyfillTestCase
+{
+    public $args = array();
+
+    protected function set_up()
+    {
+        $this->args = argParser::getArgs();
+        // hide parsing errors unless in debug mode
+        if ($this->args['DEBUG'] == 1)
+            ob_start();
+    }
+
+    protected function tear_down()
+    {
+        if ($this->args['DEBUG'] != 1)
+            return;
+        $out = ob_get_clean();
+        $status = $this->getStatus();
+        if ($status == BaseTestRunner::STATUS_ERROR
+            || $status == BaseTestRunner::STATUS_FAILURE) {
+            echo $out;
+        }
+    }
+
+    public function testSerializePHPValResponse()
+    {
+        $r = new \PhpXmlRpc\Response(array('hello' => 'world'), 0, '', 'phpvals');
+        $v = $r->serialize();
+        $this->assertStringContainsString('<member><name>hello</name>', $v);
+        $this->assertStringContainsString('<value><string>world</string></value>', $v);
+    }
+}
diff --git a/tests/03ParsingTest.php b/tests/04ParsingTest.php
similarity index 99%
rename from tests/03ParsingTest.php
rename to tests/04ParsingTest.php
index 70c81c0b..2a5831af 100644
--- a/tests/03ParsingTest.php
+++ b/tests/04ParsingTest.php
@@ -14,7 +14,7 @@ use PHPUnit\Runner\BaseTestRunner;
  *
  * @todo some tests are here even though they logically belong elsewhere...
  */
-class ParsingTests extends PhpXmlRpc_PolyfillTestCase
+class ParsingTest extends PhpXmlRpc_PolyfillTestCase
 {
     public $args = array();
 
diff --git a/tests/04LoggerTest.php b/tests/05LoggerTest.php
similarity index 100%
rename from tests/04LoggerTest.php
rename to tests/05LoggerTest.php
diff --git a/tests/06EncoderTest.php b/tests/06EncoderTest.php
index 59ba798e..4323ed48 100644
--- a/tests/06EncoderTest.php
+++ b/tests/06EncoderTest.php
@@ -15,7 +15,7 @@ use PHPUnit\Runner\BaseTestRunner;
  * @todo add tests for encoding options: 'encode_php_objs', 'auto_dates', 'null_extension' and 'extension_api'
  * @todo add tests for php_xmlrpc_decode options
  */
-class EncoderTests extends PhpXmlRpc_PolyfillTestCase
+class EncoderTest extends PhpXmlRpc_PolyfillTestCase
 {
     public $args = array();
 
diff --git a/tests/07ClientTest.php b/tests/07ClientTest.php
index dd2ab402..34905030 100644
--- a/tests/07ClientTest.php
+++ b/tests/07ClientTest.php
@@ -11,7 +11,7 @@ use PHPUnit\Runner\BaseTestRunner;
 /**
  * Tests involving the Client class (and no server).
  */
-class ClientTest extends PhpXmlRpc_PolyfillTestCase
+class ClientTes extends PhpXmlRpc_PolyfillTestCase
 {
     /** @var xmlrpc_client $client */
     public $client = null;