refactor tests to reduce duplication and clean up output
authorgggeek <giunta.gaetano@gmail.com>
Thu, 26 Jan 2023 16:33:26 +0000 (16:33 +0000)
committergggeek <giunta.gaetano@gmail.com>
Thu, 26 Jan 2023 16:33:26 +0000 (16:33 +0000)
14 files changed:
tests/01CharsetTest.php
tests/02ValueTest.php
tests/03MessagesTest.php
tests/04ParsingTest.php
tests/06EncoderTest.php
tests/07ClientTest.php
tests/08ServerTest.php
tests/09HTTPTest.php
tests/10DemofilesTest.php
tests/11DebuggerTest.php
tests/12ExtraFilesTest.php
tests/LogAwareTestCase.php [new file with mode: 0644]
tests/ServerAwareTestCase.php [new file with mode: 0644]
tests/WebTestCase.php

index a176844..70acb8f 100644 (file)
@@ -21,27 +21,12 @@ use PhpXmlRpc\Helper\Charset;
  */
 class CharsetTest extends PhpXmlRpc_PolyfillTestCase
 {
-    // Consolas font should render these properly
+    // Consolas font should render these properly. Of course this file is encoded in UTF-8
     protected $runes = "ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ";
     protected $greek = "Τὴ γλῶσσα μοῦ ἔδωσαν ἑλληνικὴ";
     protected $russian = "Река неслася; бедный чёлн";
     protected $chinese = "我能吞下玻璃而不伤身体。";
 
-    protected $latinString;
-
-    /// @todo move to usage of a dataProvider and create the latinString there
-    protected function set_up()
-    {
-        // construct a latin string with all chars (except control ones)
-        $this->latinString = "\n\r\t";
-        for($i = 32; $i < 127; $i++) {
-            $this->latinString .= chr($i);
-        }
-        for($i = 160; $i < 256; $i++) {
-            $this->latinString .= chr($i);
-        }
-    }
-
     protected function utf8ToLatin1($data)
     {
         return Charset::instance()->encodeEntities(
@@ -62,10 +47,18 @@ class CharsetTest extends PhpXmlRpc_PolyfillTestCase
 
     public function testUtf8ToLatin1All()
     {
+        $latinString = "\n\r\t";
+        for($i = 32; $i < 127; $i++) {
+            $latinString .= chr($i);
+        }
+        for($i = 160; $i < 256; $i++) {
+            $latinString .= chr($i);
+        }
+
         // the warning suppression is due to utf8_encode being deprecated in php 8.2
-        $string = @utf8_encode($this->latinString);
+        $string = @utf8_encode($latinString);
         $encoded = $this->utf8ToLatin1($string);
-        $this->assertEquals(str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $this->latinString), $encoded);
+        $this->assertEquals(str_replace(array('&', '"', "'", '<', '>'), array('&amp;', '&quot;', '&apos;', '&lt;', '&gt;'), $latinString), $encoded);
     }
 
     public function testUtf8ToLatin1EuroSymbol()
index ffd8b1d..73ba4b7 100644 (file)
@@ -1,41 +1,13 @@
 <?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;
+include_once __DIR__ . '/LogAwareTestCase.php';
 
 /**
  * Tests involving the Value class.
  * NB: these tests do not involve the parsing of xml into Value objects - look in 03ParsingTest for that
  */
-class ValueTest extends PhpXmlRpc_PolyfillTestCase
+class ValueTest extends PhpXmlRpc_LogAwareTestCase
 {
-    public $args = array();
-
-    protected function set_up()
-    {
-        $this->args = argParser::getArgs();
-        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 testMinusOneString()
     {
         $v = new xmlrpcval('-1');
index b6c4a3f..cb4a70b 100644 (file)
@@ -1,41 +1,12 @@
 <?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;
+include_once __DIR__ . '/LogAwareTestCase.php';
 
 /**
  * Tests involving Requests and Responses, except for the parsing part
  */
-class MessagesTest extends PhpXmlRpc_PolyfillTestCase
+class MessagesTest extends PhpXmlRpc_LogAwareTestCase
 {
-    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');
index 2a5831a..50b2fe4 100644 (file)
@@ -1,43 +1,14 @@
 <?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;
+include_once __DIR__ . '/LogAwareTestCase.php';
 
 /**
  * Tests involving xml parsing.
  *
  * @todo some tests are here even though they logically belong elsewhere...
  */
-class ParsingTest extends PhpXmlRpc_PolyfillTestCase
+class ParsingTest extends PhpXmlRpc_LogAwareTestCase
 {
-    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;
-        }
-    }
-
     protected function newRequest($methodName, $params = array())
     {
         $msg = new xmlrpcmsg($methodName, $params);
index 4323ed4..568256b 100644 (file)
@@ -1,13 +1,6 @@
 <?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;
+include_once __DIR__ . '/LogAwareTestCase.php';
 
 /**
  * Tests involving automatic encoding/decoding of php values into xmlrpc values (the Encoder class).
@@ -15,30 +8,8 @@ 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 EncoderTest extends PhpXmlRpc_PolyfillTestCase
+class EncoderTest extends PhpXmlRpc_LogAwareTestCase
 {
-    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 testEncodeArray()
     {
         $v = php_xmlrpc_encode(array());
index 3490503..6faac33 100644 (file)
@@ -1,44 +1,21 @@
 <?php
 
-include_once __DIR__ . '/../lib/xmlrpc.inc';
-
-include_once __DIR__ . '/parse_args.php';
-
-include_once __DIR__ . '/PolyfillTestCase.php';
-
-use PHPUnit\Runner\BaseTestRunner;
+include_once __DIR__ . '/LogAwareTestCase.php';
 
 /**
  * Tests involving the Client class (and no server).
  */
-class ClientTes extends PhpXmlRpc_PolyfillTestCase
+class ClientTes extends PhpXmlRpc_LogAwareTestCase
 {
     /** @var xmlrpc_client $client */
     public $client = null;
-    public $args = array();
 
     public function set_up()
     {
-        $this->args = argParser::getArgs();
+        parent::set_up();
 
         $this->client = new xmlrpc_client('/NOTEXIST.php', $this->args['HTTPSERVER'], 80);
         $this->client->setDebug($this->args['DEBUG']);
-
-        // in debug mode, the client will be very verbose. Avoid showing its output unless there are errors
-        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 test404()
index 40252d7..6f9f976 100644 (file)
@@ -1,22 +1,15 @@
 <?php
 
-include_once __DIR__ . '/../lib/xmlrpc.inc';
 include_once __DIR__ . '/../lib/xmlrpc_wrappers.inc';
 
-include_once __DIR__ . '/parse_args.php';
-
-include_once __DIR__ . '/PolyfillTestCase.php';
-
-use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage;
-use PHPUnit\Framework\TestResult;
-use PHPUnit\Runner\BaseTestRunner;
+include_once __DIR__ . '/ServerAwareTestCase.php';
 
 /**
  * Tests which involve interaction with the server - carried out via the client.
  * They are run against the server found in demo/server.php.
  * Includes testing of (some of) the Wrapper class
  */
-class ServerTest extends PhpXmlRpc_PolyfillTestCase
+class ServerTest extends PhpXmlRpc_ServerAwareTestCase
 {
     /** @var xmlrpc_client $client */
     protected $client = null;
@@ -24,15 +17,9 @@ class ServerTest extends PhpXmlRpc_PolyfillTestCase
     protected $timeout = 10;
     protected $request_compression = null;
     protected $accepted_compression = '';
-    protected $args = array();
 
     protected static $failed_tests = array();
 
-    protected $testId;
-    /** @var boolean $collectCodeCoverageInformation */
-    protected $collectCodeCoverageInformation;
-    protected $coverageScriptUrl;
-
     /**
      * @todo instead of overriding fail via _fail, implement Yoast\PHPUnitPolyfills\TestListeners\TestListenerDefaultImplementation
      */
@@ -53,47 +40,9 @@ class ServerTest extends PhpXmlRpc_PolyfillTestCase
         parent::_fail($message);
     }
 
-    /**
-     * Reimplemented to allow us to collect code coverage info from the target server.
-     * Code taken from PHPUnit_Extensions_Selenium2TestCase
-     *
-     * @param TestResult $result
-     * @return TestResult
-     * @throws Exception
-     *
-     * @todo instead of overriding run via _run, try to achieve this by implementing Yoast\PHPUnitPolyfills\TestListeners\TestListenerDefaultImplementation
-     */
-    public function _run($result = NULL)
-    {
-        $this->testId = get_class($this) . '__' . $this->getName();
-
-        if ($result === NULL) {
-            $result = $this->createResult();
-        }
-
-        $this->collectCodeCoverageInformation = $result->getCollectCodeCoverageInformation();
-
-        parent::_run($result);
-
-        if ($this->collectCodeCoverageInformation) {
-            $coverage = new RemoteCoverage(
-                $this->coverageScriptUrl,
-                $this->testId
-            );
-            $result->getCodeCoverage()->append(
-                $coverage->get(), $this
-            );
-        }
-
-        // do not call this before to give the time to the Listeners to run
-        //$this->getStrategy()->endOfTest($this->session);
-
-        return $result;
-    }
-
     public function set_up()
     {
-        $this->args = argParser::getArgs();
+        parent::set_up();
 
         $server = explode(':', $this->args['HTTPSERVER']);
         if (count($server) > 1) {
@@ -105,24 +54,6 @@ class ServerTest extends PhpXmlRpc_PolyfillTestCase
         $this->client->setDebug($this->args['DEBUG']);
         $this->client->request_compression = $this->request_compression;
         $this->client->accepted_compression = $this->accepted_compression;
-
-        $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']);
-
-        // in debug mode, the client will be very verbose. Avoid showing its output unless there are errors
-        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;
-        }
     }
 
     /**
index 58a0b52..ed4348e 100644 (file)
@@ -1,10 +1,5 @@
 <?php
 
-include_once __DIR__ . '/../lib/xmlrpc.inc';
-include_once __DIR__ . '/../lib/xmlrpc_wrappers.inc';
-
-include_once __DIR__ . '/parse_args.php';
-
 include_once __DIR__ . '/08ServerTest.php';
 
 /**
index eb4474b..7da6539 100644 (file)
@@ -9,15 +9,6 @@ include_once __DIR__ . '/WebTestCase.php';
  */
 class DemoFilesTest extends PhpXmlRpc_WebTestCase
 {
-    public function set_up()
-    {
-        $this->args = argParser::getArgs();
-
-        // assumes HTTPURI to be in the form /tests/index.php?etc...
-        $this->baseUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']);
-        $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']);
-    }
-
     public function testVardemo()
     {
         $page = $this->request('?demo=vardemo.php');
@@ -84,7 +75,7 @@ class DemoFilesTest extends PhpXmlRpc_WebTestCase
         $this->assertStringContainsString('<name>faultCode</name>', $page);
         $this->assertRegexp('#<int>10(5|3)</int>#', $page);
 
-        $c = $this->getClient('?demo=server/codegen.php');
+        $c = $this->newClient('?demo=server/codegen.php');
         $r = $c->send(new \PhpXmlRpc\Request('CommentManager.getComments', array(
             new \PhpXmlRpc\Value('aCommentId')
         )));
@@ -97,7 +88,7 @@ class DemoFilesTest extends PhpXmlRpc_WebTestCase
         $this->assertStringContainsString('<name>faultCode</name>', $page);
         $this->assertRegexp('#<int>10(5|3)</int>#', $page);
 
-        $c = $this->getClient('?demo=server/discuss.php');
+        $c = $this->newClient('?demo=server/discuss.php');
 
         $r = $c->send(new \PhpXmlRpc\Request('discuss.addComment', array(
             new \PhpXmlRpc\Value('aCommentId'),
index c5310a0..3844ccf 100644 (file)
@@ -7,15 +7,6 @@ include_once __DIR__ . '/WebTestCase.php';
  */
 class DebuggerTest extends PhpXmlRpc_WebTestCase
 {
-    public function set_up()
-    {
-        $this->args = argParser::getArgs();
-
-        // assumes HTTPURI to be in the form /tests/index.php?etc...
-        $this->baseUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']);
-        $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']);
-    }
-
     public function testIndex()
     {
         $page = $this->request('?debugger=index.php');
index 034d3ce..a822884 100644 (file)
@@ -7,15 +7,6 @@ include_once __DIR__ . '/WebTestCase.php';
  */
 class ExtraFilesTest extends PhpXmlRpc_WebTestCase
 {
-    public function set_up()
-    {
-        $this->args = argParser::getArgs();
-
-        // assumes HTTPURI to be in the form /tests/index.php?etc...
-        $this->baseUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']);
-        $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']);
-    }
-
     public function testBenchmark()
     {
         $page = $this->request('?extras=benchmark.php');
diff --git a/tests/LogAwareTestCase.php b/tests/LogAwareTestCase.php
new file mode 100644 (file)
index 0000000..d0dec6c
--- /dev/null
@@ -0,0 +1,60 @@
+<?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;
+
+abstract class PhpXmlRpc_LogAwareTestCase extends PhpXmlRpc_PolyfillTestCase
+{
+    protected $args = array();
+
+    protected $buffer = '';
+
+    /**
+     * hide debug messages and errors unless we either are in debug mode or the test fails
+     * @return void
+     */
+    protected function set_up()
+    {
+        $this->args = argParser::getArgs();
+
+        if ($this->args['DEBUG'] == 0) {
+            $this->debugBuffer = '';
+            $this->errorBuffer = '';
+            \PhpXmlRpc\PhpXmlRpc::setLogger($this);
+        }
+    }
+
+    protected function tear_down()
+    {
+        if ($this->args['DEBUG'] > 0) {
+            return;
+        }
+
+        // reset the logger to the default
+        \PhpXmlRpc\PhpXmlRpc::setLogger(\PhpXmlRpc\Helper\Logger::instance());
+
+        $status = $this->getStatus();
+        if ($status == BaseTestRunner::STATUS_ERROR
+            || $status == BaseTestRunner::STATUS_FAILURE) {
+            echo $this->buffer;
+        }
+    }
+
+    // logger API
+
+    public function debug($message, $context = array())
+    {
+        $this->buffer .= $message . "\n";
+    }
+
+    public function error($message, $context = array())
+    {
+        $this->buffer .= $message . "\n";
+    }
+}
diff --git a/tests/ServerAwareTestCase.php b/tests/ServerAwareTestCase.php
new file mode 100644 (file)
index 0000000..02bbb26
--- /dev/null
@@ -0,0 +1,65 @@
+<?php
+
+include_once __DIR__ . '/LogAwareTestCase.php';
+
+use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage;
+use PHPUnit\Framework\TestResult;
+
+abstract class PhpXmlRpc_ServerAwareTestCase extends PhpXmlRpc_LogAwareTestCase
+{
+    /** @var string */
+    protected $baseUrl;
+    /** @var string */
+    protected $testId;
+    /** @var boolean */
+    protected $collectCodeCoverageInformation;
+    /** @var string */
+    protected $coverageScriptUrl;
+
+    /**
+     * Reimplemented to allow us to collect code coverage info from the target server.
+     * Code taken from PHPUnit_Extensions_Selenium2TestCase
+     *
+     * @param TestResult $result
+     * @return TestResult
+     * @throws Exception
+     *
+     * @todo instead of overriding run via _run, try to achieve this by implementing Yoast\PHPUnitPolyfills\TestListeners\TestListenerDefaultImplementation
+     */
+    public function _run($result = NULL)
+    {
+        $this->testId = get_class($this) . '__' . $this->getName();
+
+        if ($result === NULL) {
+            $result = $this->createResult();
+        }
+
+        $this->collectCodeCoverageInformation = $result->getCollectCodeCoverageInformation();
+
+        parent::_run($result);
+
+        if ($this->collectCodeCoverageInformation) {
+            $coverage = new RemoteCoverage(
+                $this->coverageScriptUrl,
+                $this->testId
+            );
+            $result->getCodeCoverage()->append(
+                $coverage->get(), $this
+            );
+        }
+
+        // do not call this before to give the time to the Listeners to run
+        //$this->getStrategy()->endOfTest($this->session);
+
+        return $result;
+    }
+
+    public function set_up()
+    {
+        parent::set_up();
+
+        // assumes HTTPURI to be in the form /tests/index.php?etc...
+        $this->baseUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|\?.+|', '', $this->args['HTTPURI']);
+        $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . preg_replace('|/tests/index\.php(\?.*)?|', '/tests/phpunit_coverage.php', $this->args['HTTPURI']);
+    }
+}
index bf721b1..f2c9c41 100644 (file)
@@ -1,57 +1,12 @@
 <?php
 
-include_once __DIR__ . '/parse_args.php';
+include_once __DIR__ . '/ServerAwareTestCase.php';
 
-include_once __DIR__ . '/PolyfillTestCase.php';
-
-use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage;
-
-abstract class PhpXmlRpc_WebTestCase extends PhpXmlRpc_PolyfillTestCase
+abstract class PhpXmlRpc_WebTestCase extends PhpXmlRpc_ServerAwareTestCase
 {
-    public $args = array();
-
-    protected $baseUrl;
-
-    protected $testId;
-    /** @var boolean $collectCodeCoverageInformation */
-    protected $collectCodeCoverageInformation;
-    protected $coverageScriptUrl;
-
     /**
-     * Reimplemented to allow us to collect code coverage info for the target php files executed via an http request.
-     * Code taken from PHPUnit_Extensions_Selenium2TestCase
+     * Make an HTTP request, check that the result is a 200 OK page with no php fatal error or warning messages.
      *
-     * @todo instead of overriding run via _run, try to achieve this by implementing Yoast\PHPUnitPolyfills\TestListeners\TestListenerDefaultImplementation
-     */
-    public function _run($result = NULL)
-    {
-        $this->testId = get_class($this) . '__' . $this->getName();
-
-        if ($result === NULL) {
-            $result = $this->createResult();
-        }
-
-        $this->collectCodeCoverageInformation = $result->getCollectCodeCoverageInformation();
-
-        parent::_run($result);
-
-        if ($this->collectCodeCoverageInformation) {
-            $coverage = new RemoteCoverage(
-                $this->coverageScriptUrl,
-                $this->testId
-            );
-            $result->getCodeCoverage()->append(
-                $coverage->get(), $this
-            );
-        }
-
-        // do not call this before to give the time to the Listeners to run
-        //$this->getStrategy()->endOfTest($this->session);
-
-        return $result;
-    }
-
-    /**
      * @param string $path
      * @param string $method
      * @param string $payload
@@ -94,13 +49,19 @@ abstract class PhpXmlRpc_WebTestCase extends PhpXmlRpc_PolyfillTestCase
         return $page;
     }
 
-    protected function getClient($path)
+    /**
+     * Build an xml-rpc client, tweaked if needed to collect code-coverage information of the server
+     *
+     * @param string $path
+     * @return \PhpXmlRpc\Client
+     */
+    protected function newClient($path)
     {
-        $client = new xmlrpc_client($this->baseUrl . $path);
+        $client = new \PhpXmlRpc\Client($this->baseUrl . $path);
         if ($this->collectCodeCoverageInformation) {
             $client->setCookie('PHPUNIT_SELENIUM_TEST_ID', $this->testId);
         }
-        // let's just assume that the client works fine for these tests, and avoid polluting output
+        // let's just assume that the client works fine for these tests, and avoid polluting output, even in debug mode
         //$client->setAcceptedCompression(false);
         //$client->setDebug($this->args['DEBUG']);
         return $client;