* improved: echo all debug messages even when there are characters in them which php deems in a wrong encoding
(this is visible e.g. in the debugger)
-* improved: at debug level 1, the rebuilt php objects are not dumped to screen (server-side already did that)
+* changed: debug info handling
+ - at debug level 1, the rebuilt php objects are not dumped to screen (server-side already did that)
+ - at debug level 1, curl communication info are not dumped to screen
+ - at debug level 1, the tests echo payloads of failures; at debug level 2 all payloads
XML-RPC for PHP version 3.0.0 - 2014/6/15
}
// results into variable
- curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
- if ($this->debug) {
- curl_setopt($curl, CURLOPT_VERBOSE, 1);
+ if ($this->debug > 1) {
+ curl_setopt($curl, CURLOPT_VERBOSE, true);
/// @todo allow callers to redirect curlopt_stderr to some stream which can be buffered
}
curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);
{
public $args = array();
- public function setUp()
+ protected function setUp()
{
$this->args = argParser::getArgs();
+ if ($this->args['DEBUG'] == 1)
+ ob_start();
+ }
+
+ protected function tearDown()
+ {
+ if ($this->args['DEBUG'] != 1)
+ return;
+ $out = ob_get_clean();
+ $status = $this->getStatus();
+ if ($status == PHPUnit_Runner_BaseTestRunner::STATUS_ERROR
+ || $status == PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE) {
+ echo $out;
+ }
}
protected function newMsg($methodName, $params = array())
{
$msg = new xmlrpcmsg($methodName, $params);
- if ($this->args['DEBUG']) {
- $msg->setDebug($this->args['DEBUG']);
- }
+ $msg->setDebug($this->args['DEBUG']);
return $msg;
}
$this->args = argParser::getArgs();
$this->client = new xmlrpc_client('/NOTEXIST.php', $this->args['LOCALSERVER'], 80);
- if ($this->args['DEBUG']) {
- $this->client->setDebug($this->args['DEBUG']);
+ $this->client->setDebug($this->args['DEBUG']);
+
+ if ($this->args['DEBUG'] == 1)
+ ob_start();
+ }
+
+ protected function tearDown()
+ {
+ if ($this->args['DEBUG'] != 1)
+ return;
+ $out = ob_get_clean();
+ $status = $this->getStatus();
+ if ($status == PHPUnit_Runner_BaseTestRunner::STATUS_ERROR
+ || $status == PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE) {
+ echo $out;
}
}
} else {
$this->client = new xmlrpc_client($this->args['URI'], $this->args['LOCALSERVER']);
}
- if ($this->args['DEBUG']) {
- $this->client->setDebug($this->args['DEBUG']);
- }
+
+ $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['LOCALSERVER'] . '/' . str_replace( '/demo/server/server.php', 'tests/phpunit_coverage.php', $this->args['URI'] );
+
+ if ($this->args['DEBUG'] == 1)
+ ob_start();
+ }
+
+ protected function tearDown()
+ {
+ if ($this->args['DEBUG'] != 1)
+ return;
+ $out = ob_get_clean();
+ $status = $this->getStatus();
+ if ($status == PHPUnit_Runner_BaseTestRunner::STATUS_ERROR
+ || $status == PHPUnit_Runner_BaseTestRunner::STATUS_FAILURE) {
+ echo $out;
+ }
}
protected function send($msg, $errrorcode = 0, $return_response = false)