tests on php8
authorgggeek <giunta.gaetano@gmail.com>
Sun, 6 Dec 2020 14:56:25 +0000 (14:56 +0000)
committergggeek <giunta.gaetano@gmail.com>
Sun, 6 Dec 2020 14:56:25 +0000 (14:56 +0000)
.travis.yml
composer.json
tests/0CharsetTest.php
tests/1ParsingBugsTest.php
tests/2InvalidHostTest.php
tests/3LocalhostTest.php
tests/5DemofilesTest.php
tests/6DebuggerTest.php
tests/7ExtraTest.php
tests/LocalFileTestCase.php
tests/PolyfillTestCase.php [new file with mode: 0644]

index c7fcdd4..4d98740 100644 (file)
@@ -5,6 +5,11 @@ language: php
 # adapt the apache / env setup scripts to accommodate that...)
 dist: xenial
 
+
+global:
+    # temp workaround to xdebug 3.0.0 bug
+    - XDEBUG_MODE=coverage
+
 php:
   #- 5.3
   #- 5.4
index e5082ed..f5db6fd 100644 (file)
@@ -2,22 +2,23 @@
     "name": "phpxmlrpc/phpxmlrpc",
     "description": "A php library for building xmlrpc clients and servers",
     "license": "BSD-3-Clause",
-    "homepage": "http://gggeek.github.io/phpxmlrpc/",
+    "homepage": "https://gggeek.github.io/phpxmlrpc/",
     "keywords": [ "xmlrpc", "webservices" ],
     "require": {
         "php": ">=5.3.0",
         "ext-xml": "*"
     },
     "require-dev": {
-        "phpunit/phpunit": "~4.0 || ~5.0",
+        "phpunit/phpunit": "^4.0 || ^5.0 || ^8.5.12",
         "phpunit/phpunit-selenium": "*",
+        "yoast/phpunit-polyfills": "*",
         "ext-curl": "*",
         "ext-dom": "*",
         "ext-mbstring": "*",
         "ext-xsl": "*",
-        "indeyets/pake": "~1.99",
-        "sami/sami": "~3.3",
-        "docbook/docbook-xsl": "~1.79"
+        "indeyets/pake": "^1.99",
+        "sami/sami": "^3.3 || ^4.1",
+        "docbook/docbook-xsl": "^1.79"
     },
     "suggest": {
         "ext-curl": "Needed for HTTPS and HTTP 1.1 support, NTLM Auth etc...",
index 8a62506..c5332ad 100644 (file)
@@ -5,6 +5,8 @@
 
 use PhpXmlRpc\Helper\Charset;
 
+include_once __DIR__ . '/PolyfillTestCase.php';
+
 /**
  * Test conversion between encodings
  *
@@ -13,7 +15,7 @@ use PhpXmlRpc\Helper\Charset;
  *     chcp 28591 (latin1)
  *     chcp 65001 (utf8)
  */
-class CharsetTest extends PHPUnit_Framework_TestCase
+class CharsetTest extends PhpXmlRpc_PolyfillTestCase
 {
     // Consolas font should render these properly
     protected $runes = "ᚠᛇᚻ᛫ᛒᛦᚦ᛫ᚠᚱᚩᚠᚢᚱ᛫ᚠᛁᚱᚪ᛫ᚷᛖᚻᚹᛦᛚᚳᚢᛗ";
@@ -22,7 +24,7 @@ class CharsetTest extends PHPUnit_Framework_TestCase
     protected $chinese = "我能吞下玻璃而不伤身体。";
     protected $latinString;
 
-    protected function setUp()
+    protected function set_up()
     {
         // construct a latin string with all chars (except control ones)
         $this->latinString = "\n\r\t";
index d8f5779..4a9f23a 100644 (file)
@@ -7,21 +7,23 @@ include_once __DIR__ . '/../lib/xmlrpcs.inc';
 
 include_once __DIR__ . '/parse_args.php';
 
+include_once __DIR__ . '/PolyfillTestCase.php';
+
 /**
  * Tests involving parsing of xml and handling of xmlrpc values
  */
-class ParsingBugsTests extends PHPUnit_Framework_TestCase
+class ParsingBugsTests extends PhpXmlRpc_PolyfillTestCase
 {
     public $args = array();
 
-    protected function setUp()
+    protected function set_up()
     {
         $this->args = argParser::getArgs();
         if ($this->args['DEBUG'] == 1)
             ob_start();
     }
 
-    protected function tearDown()
+    protected function tear_down()
     {
         if ($this->args['DEBUG'] != 1)
             return;
index 1c81b55..0607c51 100644 (file)
@@ -4,16 +4,18 @@ include_once __DIR__ . '/../lib/xmlrpc.inc';
 
 include_once __DIR__ . '/parse_args.php';
 
+include_once __DIR__ . '/PolyfillTestCase.php';
+
 /**
  * Tests involving requests sent to non-existing servers
  */
-class InvalidHostTest extends PHPUnit_Framework_TestCase
+class InvalidHostTest extends PhpXmlRpc_PolyfillTestCase
 {
     /** @var xmlrpc_client $client */
     public $client = null;
     public $args = array();
 
-    public function setUp()
+    public function set_up()
     {
         $this->args = argParser::getArgs();
 
@@ -24,7 +26,7 @@ class InvalidHostTest extends PHPUnit_Framework_TestCase
             ob_start();
     }
 
-    protected function tearDown()
+    protected function tear_down()
     {
         if ($this->args['DEBUG'] != 1)
             return;
index fc4bb9e..8d35be6 100644 (file)
@@ -5,11 +5,15 @@ include_once __DIR__ . '/../lib/xmlrpc_wrappers.inc';
 
 include_once __DIR__ . '/parse_args.php';
 
+include_once __DIR__ . '/PolyfillTestCase.php';
+
+use PHPUnit\Framework\TestResult;
+
 /**
  * Tests which involve interaction between the client and the server.
  * They are run against the server found in demo/server.php
  */
-class LocalhostTest extends PHPUnit_Framework_TestCase
+class LocalhostTest extends PhpXmlRpc_PolyfillTestCase
 {
     /** @var xmlrpc_client $client */
     protected $client = null;
@@ -26,7 +30,7 @@ class LocalhostTest extends PHPUnit_Framework_TestCase
     protected $collectCodeCoverageInformation;
     protected $coverageScriptUrl;
 
-    public static function fail($message = '')
+    public static function _fail($message = '')
     {
         // save in a static var that this particular test has failed
         // (but only if not called from subclass objects / multitests)
@@ -40,18 +44,18 @@ class LocalhostTest extends PHPUnit_Framework_TestCase
             }
         }
 
-        parent::fail($message);
+        parent::_fail($message);
     }
 
     /**
      * Reimplemented to allow us to collect code coverage info from the target server.
      * Code taken from PHPUnit_Extensions_Selenium2TestCase
      *
-     * @param PHPUnit_Framework_TestResult $result
-     * @return PHPUnit_Framework_TestResult
+     * @param TestResult $result
+     * @return TestResult
      * @throws Exception
      */
-    public function run(PHPUnit_Framework_TestResult $result = NULL)
+    public function _run(TestResult $result = NULL)
     {
         $this->testId = get_class($this) . '__' . $this->getName();
 
@@ -61,7 +65,7 @@ class LocalhostTest extends PHPUnit_Framework_TestCase
 
         $this->collectCodeCoverageInformation = $result->getCollectCodeCoverageInformation();
 
-        parent::run($result);
+        parent::_run($result);
 
         if ($this->collectCodeCoverageInformation) {
             $coverage = new PHPUnit_Extensions_SeleniumCommon_RemoteCoverage(
@@ -79,7 +83,7 @@ class LocalhostTest extends PHPUnit_Framework_TestCase
         return $result;
     }
 
-    public function setUp()
+    public function set_up()
     {
         $this->args = argParser::getArgs();
 
@@ -100,7 +104,7 @@ class LocalhostTest extends PHPUnit_Framework_TestCase
             ob_start();
     }
 
-    protected function tearDown()
+    protected function tear_down()
     {
         if ($this->args['DEBUG'] != 1)
             return;
index 3cbb5b4..4ee62c8 100644 (file)
@@ -7,7 +7,7 @@ include_once __DIR__ . '/LocalFileTestCase.php';
  */
 class DemoFilesTest extends PhpXmlRpc_LocalFileTestCase
 {
-    public function setUp()
+    public function set_up()
     {
         $this->args = argParser::getArgs();
 
index db0e850..eaacd43 100644 (file)
@@ -4,7 +4,7 @@ include_once __DIR__ . '/LocalFileTestCase.php';
 
 class DebuggerTest extends PhpXmlRpc_LocalFileTestCase
 {
-    public function setUp()
+    public function set_up()
     {
         $this->args = argParser::getArgs();
 
index 14488e8..de7d48f 100644 (file)
@@ -7,7 +7,7 @@ include_once __DIR__ . '/LocalFileTestCase.php';
  */
 class ExtraTest extends PhpXmlRpc_LocalFileTestCase
 {
-    public function setUp()
+    public function set_up()
     {
         $this->args = argParser::getArgs();
 
@@ -20,4 +20,4 @@ class ExtraTest extends PhpXmlRpc_LocalFileTestCase
     {
         $page = $this->request('verify_compat.php');
     }
-}
\ No newline at end of file
+}
index 59818c8..21fda68 100644 (file)
@@ -2,7 +2,11 @@
 
 include_once __DIR__ . '/parse_args.php';
 
-abstract class PhpXmlRpc_LocalFileTestCase extends PHPUnit_Framework_TestCase
+include_once __DIR__ . '/PolyfillTestCase.php';
+
+use PHPUnit\Framework\TestResult;
+
+abstract class PhpXmlRpc_LocalFileTestCase extends PhpXmlRpc_PolyfillTestCase
 {
     public $args = array();
 
@@ -13,7 +17,7 @@ abstract class PhpXmlRpc_LocalFileTestCase extends PHPUnit_Framework_TestCase
     protected $collectCodeCoverageInformation;
     protected $coverageScriptUrl;
 
-    public function run(PHPUnit_Framework_TestResult $result = NULL)
+    public function _run(TestResult $result = NULL)
     {
         $this->testId = get_class($this) . '__' . $this->getName();
 
@@ -23,7 +27,7 @@ abstract class PhpXmlRpc_LocalFileTestCase extends PHPUnit_Framework_TestCase
 
         $this->collectCodeCoverageInformation = $result->getCollectCodeCoverageInformation();
 
-        parent::run($result);
+        parent::_run($result);
 
         if ($this->collectCodeCoverageInformation) {
             $coverage = new PHPUnit_Extensions_SeleniumCommon_RemoteCoverage(
diff --git a/tests/PolyfillTestCase.php b/tests/PolyfillTestCase.php
new file mode 100644 (file)
index 0000000..5dc8961
--- /dev/null
@@ -0,0 +1,47 @@
+<?php
+
+use PHPUnit\Framework\TestResult;
+use PHPUnit\Runner\Version as PHPUnit_Version;
+use Yoast\PHPUnitPolyfills\TestCases\TestCase;
+
+if (class_exists('PhpXmlRpc_PolyfillTestCase')) {
+    return;
+}
+
+if (class_exists(PHPUnit_Version::class) === false || version_compare(PHPUnit_Version::id(), '8.0.0', '<')) {
+    abstract class PhpXmlRpc_PolyfillTestCase extends TestCase
+    {
+        public function _run($result = null) {
+            return parent::run($result);
+        }
+
+        public static function _fail() {}
+
+        public function run($result = null) {
+            return $this->_run($result);
+        }
+
+        public static function fail($message = '') {
+            static::_fail($message);
+            self::fail($message);
+        }
+    }
+} else {
+    abstract class PhpXmlRpc_PolyfillTestCase extends TestCase
+    {
+        public function _run(TestResult $result = null) {
+            return parent::run($result);
+        }
+
+        public static function _fail() {}
+
+        public function run(TestResult $result = null): TestResult {
+            return $this->_run($result);
+        }
+
+        public static function fail(string $message = ''): void {
+            static::_fail($message);
+            parent::fail($message);
+        }
+    }
+}