better autoloading in demos
authorgggeek <giunta.gaetano@gmail.com>
Sat, 2 Jan 2021 15:36:08 +0000 (15:36 +0000)
committergggeek <giunta.gaetano@gmail.com>
Sat, 2 Jan 2021 15:36:08 +0000 (15:36 +0000)
demo/client/mail.php
demo/vardemo.php
tests/9ExtraFilesTest.php

index dfaba04..4907a7a 100644 (file)
     method)</p>
 <?php
 
-// Use the custom class autoloader. These two lines not needed when the phpxmlrpc library is installed using Composer
-include_once __DIR__ . "/../../src/Autoloader.php";
-PhpXmlRpc\Autoloader::register();
-
 if (isset($_POST["mailto"]) && $_POST["mailto"]) {
     $server = XMLRPCSERVER;
     $req = new PhpXmlRpc\Request('mail.send', array(
index 7b746f7..a47c22e 100644 (file)
@@ -1,11 +1,8 @@
-<html lang="en">
+<?php require_once __DIR__ . "/client/_prepend.php"; ?><html lang="en">
 <head><title>xmlrpc</title></head>
 <body>
 <?php
 
-/// @todo allow autoloading when the library is installed as dependency
-include_once __DIR__ . '/../vendor/autoload.php';
-
 $req = new PhpXmlRpc\Request('examples.getStateName');
 
 print "<h3>Testing value serialization</h3>\n";
@@ -93,4 +90,4 @@ print "</pre>\n";
 
 ?>
 </body>
-</html>
+</html><?php require_once __DIR__ . "/client/_append.php"; ?>
index 225ea9f..a88bace 100644 (file)
@@ -32,4 +32,10 @@ class ExtraFilesTest extends PhpXmlRpc_WebTestCase
     {
         $page = $this->request('verify_compat.php');
     }
+
+    public function testVarDemo()
+    {
+        $this->baseUrl = str_replace('/extras/', '/demo/', $this->baseUrl);
+        $page = $this->request('vardemo.php');
+    }
 }