shuffle stuff around
authorgggeek <giunta.gaetano@gmail.com>
Thu, 31 Dec 2020 15:34:23 +0000 (15:34 +0000)
committergggeek <giunta.gaetano@gmail.com>
Thu, 31 Dec 2020 15:34:23 +0000 (15:34 +0000)
12 files changed:
.travis.yml
NEWS
demo/client/perl/test.pl [moved from extras/test.pl with 100% similarity]
demo/client/python/test.py [moved from extras/test.py with 100% similarity]
extras/benchmark.php [moved from tests/benchmark.php with 100% similarity]
extras/verify_compat.php [moved from tests/verify_compat.php with 100% similarity]
src/Helper/Http.php
tests/7DemofilesTest.php
tests/8DebuggerTest.php
tests/9ExtraFilesTest.php
tests/WebTestCase.php [moved from tests/LocalFileTestCase.php with 88% similarity]
tests/parse_args.php

index 8dc6e60..90327cc 100644 (file)
@@ -53,8 +53,8 @@ before_script:
 
 script:
     - ./vendor/bin/phpunit -v $PHPUNIT_OPTS tests
-    - python3 extras/test.py
-    - perl extras/test.pl
+    - python3 demo/client/python/test.py
+    - perl extras/client/perl/test.pl
 
 after_failure:
   # Troubleshoot test env build problems
diff --git a/NEWS b/NEWS
index 03222c8..8ac948f 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -16,7 +16,8 @@ XML-RPC for PHP version 4.5.0 - 2020/12/31
 
 * minor improvements in the debugger to allow easier integration of phpxmlrpc/jsonrpc and friends
 
-* removed obsolete files from the 'extras' directory and updated the demo perl and python files
+* removed obsolete files from the 'extras' folder; updated and moved to the 'demo' folders the perl and python
+  client scripts; moved benchmark.php and verify_compat.php to the 'extras' folder
 
 
 XML-RPC for PHP version 4.4.3 - 2020/12/17
similarity index 100%
rename from extras/test.pl
rename to demo/client/perl/test.pl
similarity index 100%
rename from extras/test.py
rename to demo/client/python/test.py
similarity index 100%
rename from tests/benchmark.php
rename to extras/benchmark.php
index 10e4fed..d029a0e 100644 (file)
@@ -105,7 +105,7 @@ class Http
             // server sent a Continue header without any (valid) content following...
             // give the client a chance to know it
             if (!$pos && !is_int($pos)) {
-                // works fine in php 3, 4 and 5
+                /// @todo this construct works fine in php 3, 4 and 5 - 8; would it not be enough to have !== false now ?
 
                 break;
             }
index a769bf2..7c4b775 100644 (file)
@@ -1,11 +1,11 @@
 <?php
 
-include_once __DIR__ . '/LocalFileTestCase.php';
+include_once __DIR__ . '/WebTestCase.php';
 
 /**
  * Tests for php files in the 'demo' directory
  */
-class DemoFilesTest extends PhpXmlRpc_LocalFileTestCase
+class DemoFilesTest extends PhpXmlRpc_WebTestCase
 {
     public function set_up()
     {
index b0e7948..779ad47 100644 (file)
@@ -1,8 +1,8 @@
 <?php
 
-include_once __DIR__ . '/LocalFileTestCase.php';
+include_once __DIR__ . '/WebTestCase.php';
 
-class DebuggerTest extends PhpXmlRpc_LocalFileTestCase
+class DebuggerTest extends PhpXmlRpc_WebTestCase
 {
     public function set_up()
     {
index 64b2d8a..225ea9f 100644 (file)
@@ -1,18 +1,18 @@
 <?php
 
-include_once __DIR__ . '/LocalFileTestCase.php';
+include_once __DIR__ . '/WebTestCase.php';
 
 /**
  * Tests for php files in the 'extras' directory
  *
  */
-class ExtraFilesTest extends PhpXmlRpc_LocalFileTestCase
+class ExtraFilesTest extends PhpXmlRpc_WebTestCase
 {
     public function set_up()
     {
         $this->args = argParser::getArgs();
 
-        $this->baseUrl = $this->args['HTTPSERVER'] . str_replace( '/demo/server/server.php', '/tests/', $this->args['HTTPURI'] );
+        $this->baseUrl = $this->args['HTTPSERVER'] . str_replace( '/demo/server/server.php', '/extras/', $this->args['HTTPURI'] );
 
         $this->coverageScriptUrl = 'http://' . $this->args['HTTPSERVER'] . '/' . str_replace( '/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['HTTPURI'] );
     }
similarity index 88%
rename from tests/LocalFileTestCase.php
rename to tests/WebTestCase.php
index 4062812..f4818b3 100644 (file)
@@ -6,10 +6,7 @@ include_once __DIR__ . '/PolyfillTestCase.php';
 
 use PHPUnit\Extensions\SeleniumCommon\RemoteCoverage;
 
-/**
- * @todo rename
- */
-abstract class PhpXmlRpc_LocalFileTestCase extends PhpXmlRpc_PolyfillTestCase
+abstract class PhpXmlRpc_WebTestCase extends PhpXmlRpc_PolyfillTestCase
 {
     public $args = array();
 
@@ -54,9 +51,16 @@ abstract class PhpXmlRpc_LocalFileTestCase extends PhpXmlRpc_PolyfillTestCase
         return $result;
     }
 
-    protected function request($file, $method = 'GET', $payload = '', $emptyPageOk = false)
+    /**
+     * @param string $path
+     * @param string $method
+     * @param string $payload
+     * @param false $emptyPageOk
+     * @return bool|string
+     */
+    protected function request($path, $method = 'GET', $payload = '', $emptyPageOk = false)
     {
-        $url = $this->baseUrl . $file;
+        $url = $this->baseUrl . $path;
 
         $ch = curl_init($url);
         curl_setopt_array($ch, array(
index d4e6624..6f22c94 100644 (file)
@@ -72,17 +72,18 @@ class argParser
 
         if (!isset($HTTPURI) || $HTTPURI == '') {
             // GUESTIMATE the url of local demo server
-            // play nice to php 3 and 4-5 in retrieving URL of server.php
+            // play nice to php 4 and 5 in retrieving URL of server.php
             /// @todo filter out query string from REQUEST_URI
+            /// @todo review this code...
             if (isset($REQUEST_URI)) {
                 $HTTPURI = str_replace('/tests/testsuite.php', '/demo/server/server.php', $REQUEST_URI);
                 $HTTPURI = str_replace('/testsuite.php', '/server.php', $HTTPURI);
-                $HTTPURI = str_replace('/tests/benchmark.php', '/demo/server/server.php', $HTTPURI);
+                $HTTPURI = str_replace('/extras/benchmark.php', '/demo/server/server.php', $HTTPURI);
                 $HTTPURI = str_replace('/benchmark.php', '/server.php', $HTTPURI);
             } elseif (isset($_SERVER['PHP_SELF']) && isset($_SERVER['REQUEST_METHOD'])) {
                 $HTTPURI = str_replace('/tests/testsuite.php', '/demo/server/server.php', $_SERVER['PHP_SELF']);
                 $HTTPURI = str_replace('/testsuite.php', '/server.php', $HTTPURI);
-                $HTTPURI = str_replace('/tests/benchmark.php', '/demo/server/server.php', $HTTPURI);
+                $HTTPURI = str_replace('/extras/benchmark.php', '/demo/server/server.php', $HTTPURI);
                 $HTTPURI = str_replace('/benchmark.php', '/server.php', $HTTPURI);
             } else {
                 $HTTPURI = '/demo/server/server.php';