X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;ds=sidebyside;f=tests%2F2InvalidHostTest.php;h=1c81b550cabe772ee821f722f4a5e00e08580d38;hb=509dee39962ec712884f1c6658f383c4db793785;hp=0168c91efed0c33e1d7f0da6b64ea24f69bf5cd3;hpb=9337670bd021202018213a156c0083dd72902571;p=plcapi.git diff --git a/tests/2InvalidHostTest.php b/tests/2InvalidHostTest.php index 0168c91..1c81b55 100644 --- a/tests/2InvalidHostTest.php +++ b/tests/2InvalidHostTest.php @@ -4,6 +4,9 @@ include_once __DIR__ . '/../lib/xmlrpc.inc'; include_once __DIR__ . '/parse_args.php'; +/** + * Tests involving requests sent to non-existing servers + */ class InvalidHostTest extends PHPUnit_Framework_TestCase { /** @var xmlrpc_client $client */ @@ -35,20 +38,20 @@ class InvalidHostTest extends PHPUnit_Framework_TestCase public function test404() { - $f = new xmlrpcmsg('examples.echo', array( + $m = new xmlrpcmsg('examples.echo', array( new xmlrpcval('hello', 'string'), )); - $r = $this->client->send($f, 5); + $r = $this->client->send($m, 5); $this->assertEquals(5, $r->faultCode()); } public function testSrvNotFound() { - $f = new xmlrpcmsg('examples.echo', array( + $m = new xmlrpcmsg('examples.echo', array( new xmlrpcval('hello', 'string'), )); $this->client->server .= 'XXX'; - $r = $this->client->send($f, 5); + $r = $this->client->send($m, 5); // make sure there's no freaking catchall DNS in effect $dnsinfo = dns_get_record($this->client->server); if ($dnsinfo) { @@ -65,13 +68,13 @@ class InvalidHostTest extends PHPUnit_Framework_TestCase return; } - $f = new xmlrpcmsg('examples.stringecho', array( + $m = new xmlrpcmsg('examples.stringecho', array( new xmlrpcval('hello', 'string'), )); // test 2 calls w. keepalive: 1st time connection ko, second time ok $this->client->server .= 'XXX'; $this->client->keepalive = true; - $r = $this->client->send($f, 5, 'http11'); + $r = $this->client->send($m, 5, 'http11'); // in case we have a "universal dns resolver" getting in the way, we might get a 302 instead of a 404 $this->assertTrue($r->faultCode() === 8 || $r->faultCode() == 5); @@ -83,7 +86,7 @@ class InvalidHostTest extends PHPUnit_Framework_TestCase $this->client->server = $server[0]; $this->client->path = $this->args['URI']; - $r = $this->client->send($f, 5, 'http11'); + $r = $this->client->send($m, 5, 'http11'); $this->assertEquals(0, $r->faultCode()); $ro = $r->value(); is_object($ro) && $this->assertEquals('hello', $ro->scalarVal());