From 2e14d2211d140627c3f12aad2382eba9f59f645f Mon Sep 17 00:00:00 2001 From: gggeek Date: Tue, 17 Jan 2023 12:11:25 +0000 Subject: [PATCH] add a test for the new demo --- demo/client/windowscharset.php | 10 +++++++--- tests/7DemofilesTest.php | 5 +++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/demo/client/windowscharset.php b/demo/client/windowscharset.php index c785cd77..3c399179 100644 --- a/demo/client/windowscharset.php +++ b/demo/client/windowscharset.php @@ -11,6 +11,10 @@ use PhpXmlRpc\PhpXmlRpc; use PhpXmlRpc\Request; use PhpXmlRpc\Value; +if (!function_exists('mb_convert_encoding')) { + die('This demo requires mbstring support'); +} + PhpXmlRpc::$xmlrpc_internalencoding = 'Windows-1252'; // this is a very contrived way of creating a CP-1252 string... @@ -28,11 +32,11 @@ $c = new Client(XMLRPCSERVER); // allow the full request and response to be seen on screen $c->setDebug(2); -// tell the server not to compress the response +// tell the server not to compress the response - this is not necessary btw, it is only done to make the debug look nicer $c->accepted_compression = array(); -// tell the server not to encode everything as ASCII - this is not necessary btw. It is only done to make the demo nicer +// tell the server not to encode everything as ASCII - this is not necessary btw, it is only done to make the debug look nicer $c->accepted_charset_encodings = array('UTF-8'); -// force the client not to encode everything as ASCII - this is not necessary btw. It is only done to make the demo nicer +// force the client not to encode everything as ASCII - this is not necessary btw, it is only done to make the debug nicer $c->request_charset_encoding = 'UTF-8'; $r = $c->send(new Request('examples.stringecho', array(new Value($input)))); diff --git a/tests/7DemofilesTest.php b/tests/7DemofilesTest.php index bb745469..fe8b228c 100644 --- a/tests/7DemofilesTest.php +++ b/tests/7DemofilesTest.php @@ -59,6 +59,11 @@ class DemoFilesTest extends PhpXmlRpc_WebTestCase $page = $this->request('?demo=client/which.php'); } + public function testWindowsCharset() + { + $page = $this->request('?demo=client/windowscharset.php'); + } + public function testWrap() { $page = $this->request('?demo=client/wrap.php'); -- 2.47.0