|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* Hackish code used to make the demos both viewable as source, runnable, and viewable as html |
|
4
|
|
|
*/ |
|
5
|
|
|
|
|
6
|
|
|
if (isset($_GET['showSource']) && $_GET['showSource']) { |
|
7
|
|
|
$file = debug_backtrace()[0]['file']; |
|
8
|
|
|
highlight_file($file); |
|
9
|
|
|
die(); |
|
10
|
|
|
} |
|
11
|
|
|
|
|
12
|
|
|
// Make errors visible |
|
13
|
|
|
ini_set('display_errors', true); |
|
|
|
|
|
|
14
|
|
|
error_reporting(E_ALL); |
|
15
|
|
|
|
|
16
|
|
|
// Use the custom class autoloader. These two lines not needed when the phpxmlrpc library is installed using Composer |
|
17
|
|
|
include_once __DIR__ . '/../../src/Autoloader.php'; |
|
18
|
|
|
PhpXmlRpc\Autoloader::register(); |
|
19
|
|
|
|
|
20
|
|
|
// Let unit tests run against localhost, 'plain' demos against a known public server |
|
21
|
|
|
if (isset($_SERVER['HTTPSERVER'])) { |
|
22
|
|
|
define('XMLRPCSERVER', 'http://'.$_SERVER['HTTPSERVER'].'/demo/server/server.php'); |
|
23
|
|
|
} else { |
|
24
|
|
|
define('XMLRPCSERVER', 'http://gggeek.altervista.org/sw/xmlrpc/demo/server/server.php'); |
|
25
|
|
|
} |
|
26
|
|
|
|
|
27
|
|
|
// Out-of-band information: let the client manipulate the page operations. |
|
28
|
|
|
// We do this to help the testsuite script: do not reproduce in production! |
|
29
|
|
|
if (isset($_COOKIE['PHPUNIT_SELENIUM_TEST_ID']) && extension_loaded('xdebug')) { |
|
30
|
|
|
$GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'] = '/tmp/phpxmlrpc_coverage'; |
|
31
|
|
|
if (!is_dir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'])) { |
|
32
|
|
|
mkdir($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY']); |
|
33
|
|
|
chmod($GLOBALS['PHPUNIT_COVERAGE_DATA_DIRECTORY'], 0777); |
|
34
|
|
|
} |
|
35
|
|
|
|
|
36
|
|
|
include_once __DIR__ . "/../../vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon/prepend.php"; |
|
37
|
|
|
} |
|
38
|
|
|
|
|
39
|
|
|
// A helper for cli vs we output: |
|
40
|
|
|
function output($text) |
|
41
|
|
|
{ |
|
42
|
8 |
|
echo PHP_SAPI == 'cli' ? strip_tags(str_replace('<br/>', "\n", $text)) : $text; |
|
43
|
|
|
} |
|
44
|
|
|
|