Overview

Packages

  • Jyxo_Beholder
  • Jyxo_Charset
  • Jyxo_Color
  • Jyxo_Css
  • Jyxo_ErrorHandling
  • Jyxo_FirePhp
  • Jyxo_Gettext
    • Parser
  • Jyxo_Html
  • Jyxo_Input
    • Chain
    • Filter
    • Validator
  • Jyxo_Mail
    • Email
    • Parser
    • Sender
  • Jyxo_Rpc
    • Json
    • Xml
  • Jyxo_Shell
  • Jyxo_SpamFilter
  • Jyxo_Spl
  • Jyxo_String
  • Jyxo_Svn
  • Jyxo_Time
  • Jyxo_Timer
  • Jyxo_Webdav
  • Jyxo_XmlReader
  • PHP

Classes

  • Jyxo_Beholder_Executor
  • Jyxo_Beholder_Result
  • Jyxo_Beholder_TestCase
  • Jyxo_Beholder_TestCase_FileSystem
  • Jyxo_Beholder_TestCase_HttpResponse
  • Jyxo_Beholder_TestCase_Imap
  • Jyxo_Beholder_TestCase_JsonRpc
  • Jyxo_Beholder_TestCase_Memcached
  • Jyxo_Beholder_TestCase_Mysql
  • Jyxo_Beholder_TestCase_Pgsql
  • Jyxo_Beholder_TestCase_PhpExtension
  • Jyxo_Beholder_TestCase_PhpVersion
  • Jyxo_Beholder_TestCase_PhpZend
  • Jyxo_Beholder_TestCase_Smtp
  • Jyxo_Beholder_TestCase_Webdav
  • Jyxo_Beholder_TestCase_XmlRpc
  • Overview
  • Package
  • Class
  • Tree
  • Deprecated
  1: <?php
  2: 
  3: /**
  4:  * Jyxo PHP Library
  5:  *
  6:  * LICENSE
  7:  *
  8:  * This source file is subject to the new BSD license that is bundled
  9:  * with this package in the file license.txt.
 10:  * It is also available through the world-wide-web at this URL:
 11:  * https://github.com/jyxo/php/blob/master/license.txt
 12:  */
 13: 
 14: /**
 15:  * Tests XML-RPC server availability.
 16:  *
 17:  * @category Jyxo
 18:  * @package Jyxo_Beholder
 19:  * @copyright Copyright (c) 2005-2011 Jyxo, s.r.o.
 20:  * @license https://github.com/jyxo/php/blob/master/license.txt
 21:  * @author Jaroslav HanslĂ­k
 22:  */
 23: class Jyxo_Beholder_TestCase_XmlRpc extends Jyxo_Beholder_TestCase
 24: {
 25:     /**
 26:      * XML-RPC server URL.
 27:      *
 28:      * @var string
 29:      */
 30:     private $url;
 31: 
 32:     /**
 33:      * Method name.
 34:      *
 35:      * @var string
 36:      */
 37:     private $method;
 38: 
 39:     /**
 40:      * Method parameters.
 41:      *
 42:      * @var string
 43:      */
 44:     private $params = array();
 45: 
 46:     /**
 47:      * Request options.
 48:      *
 49:      * @var array
 50:      */
 51:     private $options = array();
 52: 
 53:     /**
 54:      * Timeout.
 55:      *
 56:      * @var integer
 57:      */
 58:     private $timeout;
 59: 
 60:     /**
 61:      * Constructor.
 62:      *
 63:      * @param string $description Test description
 64:      * @param string $url Server URL
 65:      * @param string $method Method name
 66:      * @param array $params Method parameters
 67:      * @param array $options Request options
 68:      * @param integer $timeout Timeout
 69:      */
 70:     public function __construct($description, $url, $method, array $params, array $options = array(), $timeout = 2)
 71:     {
 72:         parent::__construct($description);
 73: 
 74:         $this->url = (string) $url;
 75:         $this->method = (string) $method;
 76:         $this->params = $params;
 77:         $this->options = $options;
 78:         $this->timeout = (int) $timeout;
 79:     }
 80: 
 81:     /**
 82:      * Performs the test.
 83:      *
 84:      * @return Jyxo_Beholder_Result
 85:      */
 86:     public function run()
 87:     {
 88:         // The xmlrpc extension is required
 89:         if (!extension_loaded('xmlrpc')) {
 90:             return new Jyxo_Beholder_Result(Jyxo_Beholder_Result::NOT_APPLICABLE, 'Extension xmlrpc missing');
 91:         }
 92: 
 93:         // The curl extension is required
 94:         if (!extension_loaded('curl')) {
 95:             return new Jyxo_Beholder_Result(Jyxo_Beholder_Result::NOT_APPLICABLE, 'Extension curl missing');
 96:         }
 97: 
 98:         // The Jyxo_Rpc_Xml_Client class is required
 99:         if (!class_exists('Jyxo_Rpc_Xml_Client')) {
100:             return new Jyxo_Beholder_Result(Jyxo_Beholder_Result::NOT_APPLICABLE, 'Class Jyxo_Rpc_Xml_Client missing');
101:         }
102: 
103:         // Create the RPC client
104:         $rpc = new Jyxo_Rpc_Xml_Client();
105:         foreach ($this->options as $name => $value) {
106:             $rpc->setOption($name, $value);
107:         }
108:         $rpc->setUrl($this->url)
109:             ->setTimeout($this->timeout);
110: 
111:         // Send the request
112:         try {
113:             $rpc->send($this->method, $this->params);
114:         } catch (Exception $e) {
115:             return new Jyxo_Beholder_Result(Jyxo_Beholder_Result::FAILURE, $this->url);
116:         }
117: 
118:         // OK
119:         return new Jyxo_Beholder_Result(Jyxo_Beholder_Result::SUCCESS, $this->url);
120:     }
121: }
122: 
Jyxo PHP Library API documentation generated by ApiGen 2.3.0