if ((int)ini_get('max_execution_time') < 180)
ini_set('max_execution_time', 180);
+ ini_set('max_execution_time', 180);
$suite = new PHPUnit_TestSuite();
function setUp()
{
global $DEBUG, $LOCALSERVER, $URI;
- $server = split(':', $LOCALSERVER);
+ $server = explode(':', $LOCALSERVER);
if(count($server) > 1)
{
- $this->client=&new xmlrpc_client($URI, $server[0], $server[1]);
+ $this->client=new xmlrpc_client($URI, $server[0], $server[1]);
}
else
{
- $this->client=&new xmlrpc_client($URI, $LOCALSERVER);
+ $this->client=new xmlrpc_client($URI, $LOCALSERVER);
}
if($DEBUG)
{
}
}
+ 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();
+ $t3 = new xmlrpcval($datetime->setTimestamp($time), 'dateTime.iso8601');
+ $this->assertEquals($t1->serialize(), $t3->serialize());
+ }
+ }
+
function testCountEntities()
{
$sendstring = "h'fd>onc>>l>>rw&bpu>q>e<v&gxs<ytjzkami<";
$v1 = php_xmlrpc_encode($data, array('auto_dates'));
$v2 = php_xmlrpc_decode_xml($v1->serialize());
$this->assertEquals($v1, $v2);
- $r1 =& new xmlrpcresp($v1);
+ $r1 = new xmlrpcresp($v1);
$r2 = php_xmlrpc_decode_xml($r1->serialize());
$r2->serialize(); // needed to set internal member payload
$this->assertEquals($r1, $r2);
- $m1 =& new xmlrpcmsg('hello dolly', array($v1));
+ $m1 = new xmlrpcmsg('hello dolly', array($v1));
$m2 = php_xmlrpc_decode_xml($m1->serialize());
$m2->serialize(); // needed to set internal member payload
$this->assertEquals($m1, $m2);
$r = $m->parseresponse($s);
$v = $r->value();
$this->assertequals('null', $v->scalartyp());
+ // test with the apache version: EX:NIL
+ $GLOBALS['xmlrpc_null_apache_encoding'] = true;
+ // serialization
+ $v = new xmlrpcval('hello', 'null');
+ $s = $v->serialize();
+ $this->assertequals(1, preg_match( '#<value><ex:nil/></value>#', $s ));
+ // deserialization
+ $r = new xmlrpcresp($v);
+ $s = $r->serialize();
+ $r = $m->parseresponse($s);
+ $v = $r->value();
+ $this->assertequals('null', $v->scalartyp());
+ $GLOBALS['xmlrpc_null_extension'] = false;
+ $r = $m->parseresponse($s);
+ $this->assertequals(2, $r->faultCode());
}
function TestLocale()
$this->assertEquals(8, $r->faultCode());
// now test a successful connection
- $server = split(':', $LOCALSERVER);
+ $server = explode(':', $LOCALSERVER);
if(count($server) > 1)
{
$this->client->port = $server[1];
$suite->addTest(new LocalhostTests('testBoolean'));
$suite->addTest(new LocalhostTests('testCountEntities'));
$suite->addTest(new LocalhostTests('testBase64'));
+ $suite->addTest(new LocalhostTests('testDateTime'));
$suite->addTest(new LocalhostTests('testServerMulticall'));
$suite->addTest(new LocalhostTests('testClientMulticall1'));
$suite->addTest(new LocalhostTests('testClientMulticall2'));
echo "<h3>Using lib version: $xmlrpcVersion on PHP version: ".phpversion()."</h3>\n";
echo '<h3>Running '.$suite->testCount().' tests (some of which are multiple) against servers: http://'.htmlspecialchars($LOCALSERVER.$URI).' and https://'.htmlspecialchars($HTTPSSERVER.$HTTPSURI)."\n ...</h3>\n";
flush();
+ ob_flush();
}
else
{
<?php
echo $result->toHTML()."\n</body>\n</html>\n";
}
-?>
+?>
\ No newline at end of file