Пример #1
0
 /**
  * Verify exception is throw when no method is passed for indirect 
  * invocation
  * 
  * @depends           testFactoryCanReturnWHMFromSimpleConfig
  * @expectedException Exception
  * @outputBuffering   disabled
  */
 public function testCallerThrowExceptionWhenNoArgsOnDispatchedApiRequest()
 {
     $arr = array('service' => array('whm' => array('config' => array('host' => '1.1.1.1'))));
     Cpanel_PublicAPI::resetInstance();
     $cp = Cpanel_PublicAPI::getInstance($arr);
     $response = $cp->whm_api();
 }
 /**
  * A Service can be instantiated directly from the library
  */
 $whm = new Cpanel_Service_WHM($config);
 $response = $whm->xmlapi_query('version');
 echo "WHM Version: {$response->version}\n\n";
 /**
  * Reseting the PubicAPI internals for example to function cleanly
  * WARNING:
  *  resetInstance() is used here so that the example functions
  *  out-of-the-box. There shoud be no reason for this in production code,
  *  since a master config will not change during the execution of any given
  *  script using the PublicAPI client.
  *  -- DO NOT use the following static function in production code! --
  */
 Cpanel_PublicAPI::resetInstance();
 /**
  * PublicAPI's global configuration array
  * 
  * The global configuration array, that is passed on the first call to
  * PublicAPI::getInstance(), consists of two namespaces:
  *  * package
  *    - Response for the internal behavior of the PublicAPI client itself
  *  * service
  *    - Contains configuration for Service objects
  *    
  * So, the basic structure of a global configuration array would be:
  * <?php
  * $cfg = array(
  *     'cpanel' => array(
  *         'package'=> array(),  // An array for PublicAPI behavior