* new: it is now possible to inject a custom logger into helper classes `Charset`, `Http`, `XMLParser`, inching a step
closer to supporting DIC patterns
+* new: passing value -1 to `$client->setDebug` will avoid storing the full http response data in the returned Response
+ object when executing `call`. This could be useful in reducing memory usage for big responses
+
* new: when calling `Wrapper::wrapXmlrpcMethod` and `wrapXmlrpcServer`, it is possible to pass 'throw_on_fault' as option
to argument `$extraOptions`. This will make the generated function throw on http errors and xml-rpc faults instead of
returning a Response object
* improved: when calling `Client::multicall()`, the returned `Response` objects did not have any data in their `httpResponse`
-* improved: method `Helper\Date::iso8601Encode` now accepts a DateTime input beside a timestamp
+* new: method `Helper\Date::iso8601Encode` now accepts a DateTime input beside a timestamp
-* improved: method `Server::add_to_map` has acquired a 6th parameter: `$parametersType = false`
+* new: method `Server::add_to_map` has acquired a 6th parameter: `$parametersType = false`
* improved: the `XMLParser` accepts more options in its constructor (see phpdocs for details)
date_default_timezone_set($tz);
}
+ /// @todo is this included in the above?
+ public function testDateTime()
+ {
+ $time = time();
+ $t1 = new xmlrpcval($time, 'dateTime.iso8601');
+ $t2 = new xmlrpcval(iso8601_encode($time), 'dateTime.iso8601');
+ $this->assertEquals($t1->serialize(), $t2->serialize());
+ $datetime = new DateTime();
+ $t3 = new xmlrpcval($datetime->setTimestamp($time), 'dateTime.iso8601');
+ $this->assertEquals($t1->serialize(), $t3->serialize());
+ }
+
public function testStructMemExists()
{
$v = new xmlrpcval(array('hello' => new xmlrpcval('world')), 'struct');
use PHPUnit\Runner\BaseTestRunner;
/**
- * Tests which involve interaction between the client and the server.
+ * Tests which involve interaction with the server - carried out via the client.
* They are run against the server found in demo/server.php.
* Includes testing of (some of) the Wrapper class
*/
public function testAddingDoubles()
{
- // note that rounding errors mean we
- // keep precision to sensible levels here ;-)
+ // note that rounding errors mean we keep precision to sensible levels here ;-)
$a = 12.13;
$b = -23.98;
$m = new xmlrpcmsg('examples.addtwodouble', array(
}
}
- public function testDateTime()
- {
- $time = time();
- $t1 = new xmlrpcval($time, 'dateTime.iso8601');
- $t2 = new xmlrpcval(iso8601_encode($time), 'dateTime.iso8601');
- $this->assertEquals($t1->serialize(), $t2->serialize());
- if (class_exists('DateTime')) {
- $datetime = new DateTime();
- // skip this test for php 5.2. It is a bit harder there to build a DateTime from unix timestamp with proper TZ info
- if (is_callable(array($datetime, 'setTimestamp'))) {
- $t3 = new xmlrpcval($datetime->setTimestamp($time), 'dateTime.iso8601');
- $this->assertEquals($t1->serialize(), $t3->serialize());
- }
- }
- }
-
public function testCountEntities()
{
$sendString = "h'fd>onc>>l>>rw&bpu>q>e<v&gxs<ytjzkami<";
}
}
- public function _multicall_msg($method, $params)
+ protected function _multicall_msg($method, $params)
{
+ $struct = array();
$struct['methodName'] = new xmlrpcval($method, 'string');
$struct['params'] = new xmlrpcval($params, 'array');
public function testCatchExceptions()
{
- // this tests for the server to catch exceptions with erro code 0
+ // this tests for the server to catch exceptions with error code 0
$m = new xmlrpcmsg('tests.raiseException', array(
new xmlrpcval(0, 'int'),
));
$this->assertEquals($v1, $v2);
}
}
+
+ public function testNegativeDebug()
+ {
+ $m = new xmlrpcmsg('examples.stringecho', array(
+ new xmlrpcval('hello world', 'string'),
+ ));
+ $v1 = $this->send($m, 0, true);
+ $h = $v1->httpResponse();
+ $this->assertEquals('200', $h['status_code']);
+ $this->assertNotEmpty($h['headers']);
+
+ $d = $this->client->debug;
+ $this->client->setDebug(-1);
+ $v2 = $this->send($m, 0, true);
+ $this->client->setDebug($d);
+ $h = $v2->httpResponse();
+ $this->assertEmpty($h['headers']);
+ $this->assertEmpty($h['raw_data']);
+ }
}