예제 #1
0
 /**
  * Create a new ServiceBuilder using configuration data sourced from an
  * array, .json|.js file, SimpleXMLElement, or .xml file.
  *
  * @param array|string|\SimpleXMLElement $data An instantiated
  *     SimpleXMLElement containing configuration data, the full path to an
  *     .xml or .js|.json file, or an associative array of data
  * @param array $globalParameters Array of global parameters to
  *     pass to every service as it is instantiated.
  *
  * @return ServiceBuilderInterface
  * @throws ServiceBuilderException if a file cannot be opened
  * @throws ServiceNotFoundException when trying to extend a missing client
  */
 public static function factory($config = null, array $globalParameters = null)
 {
     // @codeCoverageIgnoreStart
     if (!self::$defaultFactory) {
         self::$defaultFactory = new ServiceBuilderAbstractFactory();
     }
     // @codeCoverageIgnoreEnd
     return self::$defaultFactory->build($config, $globalParameters);
 }
 /**
  * @expectedException Guzzle\Service\Exception\ServiceBuilderException
  * @expectedExceptionMessage Must pass a file name, array, or SimpleXMLElement
  */
 public function testThrowsExceptionWhenUnknownTypeIsPassed()
 {
     $factory = new ServiceBuilderAbstractFactory();
     $factory->build(new \stdClass());
 }