InvalidHostTests

The Contact Form 7 - Infusionsoft Add-on InvalidHostTests class.

Defined (1)

The class is defined in the following location(s).

/src/xmlrpc-3.0/test/testsuite.php  
  1. class InvalidHostTests extends PHPUnit_TestCase 
  2. var $client = null; 
  3.  
  4. function setUp() 
  5. global $DEBUG, $LOCALSERVER; 
  6. $this->client=new xmlrpc_client('/NOTEXIST.php', $LOCALSERVER, 80); 
  7. if($DEBUG) 
  8. $this->client->setDebug($DEBUG); 
  9.  
  10. function test404() 
  11. $f = new xmlrpcmsg('examples.echo', array( 
  12. new xmlrpcval('hello', 'string') 
  13. )); 
  14. $r = $this->client->send($f, 5); 
  15. $this->assertEquals(5, $r->faultCode()); 
  16.  
  17. function testSrvNotFound() 
  18. $f = new xmlrpcmsg('examples.echo', array( 
  19. new xmlrpcval('hello', 'string') 
  20. )); 
  21. $this->client->server .= 'XXX'; 
  22. $r = $this->client->send($f, 5); 
  23. $this->assertEquals(5, $r->faultCode()); 
  24.  
  25. function testCurlKAErr() 
  26. global $LOCALSERVER, $URI; 
  27. if(!function_exists('curl_init')) 
  28. $this->fail('CURL missing: cannot test curl keepalive errors'); 
  29. return; 
  30. $f = new xmlrpcmsg('examples.stringecho', array( 
  31. new xmlrpcval('hello', 'string') 
  32. )); 
  33. // test 2 calls w. keepalive: 1st time connection ko, second time ok 
  34. $this->client->server .= 'XXX'; 
  35. $this->client->keepalive = true; 
  36. $r = $this->client->send($f, 5, 'http11'); 
  37. $this->assertEquals(8, $r->faultCode()); 
  38.  
  39. // now test a successful connection 
  40. $server = explode(':', $LOCALSERVER); 
  41. if(count($server) > 1) 
  42. $this->client->port = $server[1]; 
  43. $this->client->server = $server[0]; 
  44. $this->client->path = $URI; 
  45.  
  46. $r = $this->client->send($f, 5, 'http11'); 
  47. $ro = $r->value(); 
  48. $this->assertEquals('hello', $ro->scalarVal());