include_once __DIR__ . '/parse_args.php';
+/**
+ * Tests which involve interaction between the client and the server.
+ * They are run against the server found in demo/server.php
+ */
class LocalhostTest extends PHPUnit_Framework_TestCase
{
/** @var xmlrpc_client $client */
public function testWrappedMethod()
{
// make a 'deep client copy' as the original one might have many properties set
- $func = wrap_xmlrpc_method($this->client, 'examples.getStateName', array('simple_client_copy' => 1));
- if ($func == '') {
+ $func = wrap_xmlrpc_method($this->client, 'examples.getStateName', array('simple_client_copy' => 0));
+ if ($func == false) {
$this->fail('Registration of examples.getStateName failed');
} else {
$v = $func(23);
}
}
+ public function testWrappedMethodAsSource()
+ {
+ // make a 'deep client copy' as the original one might have many properties set
+ $func = wrap_xmlrpc_method($this->client, 'examples.getStateName', array('simple_client_copy' => 0, 'return_source' => true));
+ if ($func == false) {
+ $this->fail('Registration of examples.getStateName failed');
+ } else {
+ eval($func['source']);
+ $func = $func['function'];
+ $v = $func(23);
+ // work around bug in current version of phpunit
+ if (is_object($v)) {
+ $v = var_export($v, true);
+ }
+ $this->assertEquals('Michigan', $v);
+ }
+ }
+
public function testWrappedClass()
{
// make a 'deep client copy' as the original one might have many properties set
- $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 1));
+ $class = wrap_xmlrpc_server($this->client, array('simple_client_copy' => 0));
if ($class == '') {
$this->fail('Registration of remote server failed');
} else {
include_once __DIR__ . '/3LocalhostTest.php';
+/**
+ * Tests which stress http features of the library.
+ * Each of these tests iterates over (almost) all of the 'localhost' tests
+ */
class LocalhostMultiTest extends LocalhostTest
{
/**
{
if(!function_exists('gzdeflate'))
{
- $this->fail('Zlib missing: cannot test deflate functionality');
+ $this->markTestSkipped('Zlib missing: cannot test deflate functionality');
return;
}
$this->client->accepted_compression = array('deflate');
{
if(!function_exists('gzdeflate'))
{
- $this->fail('Zlib missing: cannot test gzip functionality');
+ $this->markTestSkipped('Zlib missing: cannot test gzip functionality');
return;
}
$this->client->accepted_compression = array('gzip');
{
if(!function_exists('curl_init'))
{
- $this->fail('CURL missing: cannot test http 1.1');
+ $this->markTestSkipped('CURL missing: cannot test http 1.1');
return;
}
$this->method = 'http11';
$this->_runtests();
}
else
- $this->fail('PROXY definition missing: cannot test proxy');
+ $this->markTestSkipped('PROXY definition missing: cannot test proxy');
}
function testHttp11()
{
if(!function_exists('curl_init'))
{
- $this->fail('CURL missing: cannot test http 1.1');
+ $this->markTestSkipped('CURL missing: cannot test http 1.1');
return;
}
$this->method = 'http11'; // not an error the double assignment!
{
if(!function_exists('curl_init'))
{
- $this->fail('CURL missing: cannot test http 1.1');
+ $this->markTestSkipped('CURL missing: cannot test http 1.1');
return;
}
$this->method = 'http11'; // not an error the double assignment!
{
if(!function_exists('curl_init'))
{
- $this->fail('CURL missing: cannot test http 1.1');
+ $this->markTestSkipped('CURL missing: cannot test http 1.1');
return;
}
$this->method = 'http11'; // not an error the double assignment!
{
if(!function_exists('curl_init'))
{
- $this->fail('CURL missing: cannot test http 1.1 w. proxy');
+ $this->markTestSkipped('CURL missing: cannot test http 1.1 w. proxy');
return;
}
else if ($this->args['PROXYSERVER'] == '')
{
- $this->fail('PROXY definition missing: cannot test proxy w. http 1.1');
+ $this->markTestSkipped('PROXY definition missing: cannot test proxy w. http 1.1');
return;
}
$this->method = 'http11'; // not an error the double assignment!
{
if(!function_exists('curl_init'))
{
- $this->fail('CURL missing: cannot test https functionality');
+ $this->markTestSkipped('CURL missing: cannot test https functionality');
return;
}
$this->client->server = $this->args['HTTPSSERVER'];
{
if(!function_exists('curl_init'))
{
- $this->fail('CURL missing: cannot test https functionality');
+ $this->markTestSkipped('CURL missing: cannot test https functionality');
return;
}
else if ($this->args['PROXYSERVER'] == '')
{
- $this->fail('PROXY definition missing: cannot test proxy w. http 1.1');
+ $this->markTestSkipped('PROXY definition missing: cannot test proxy w. http 1.1');
return;
}
$this->client->server = $this->args['HTTPSSERVER'];