From 02b7f45d24e026dd832abe0bea37621b7bee953a Mon Sep 17 00:00:00 2001 From: gggeek Date: Wed, 25 Jan 2023 16:27:48 +0000 Subject: [PATCH] tests --- tests/02ValueTest.php | 2 +- tests/03MessagesTest.php | 46 +++++++++++++++++++ .../{03ParsingTest.php => 04ParsingTest.php} | 2 +- tests/{04LoggerTest.php => 05LoggerTest.php} | 0 tests/06EncoderTest.php | 2 +- tests/07ClientTest.php | 2 +- 6 files changed, 50 insertions(+), 4 deletions(-) create mode 100644 tests/03MessagesTest.php rename tests/{03ParsingTest.php => 04ParsingTest.php} (99%) rename tests/{04LoggerTest.php => 05LoggerTest.php} (100%) 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 @@ +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('hello', $v); + $this->assertStringContainsString('world', $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; -- 2.47.0