当前位置: 首页>>代码示例>>PHP>>正文


PHP OperationCommand::prepare方法代码示例

本文整理汇总了PHP中Guzzle\Service\Command\OperationCommand::prepare方法的典型用法代码示例。如果您正苦于以下问题:PHP OperationCommand::prepare方法的具体用法?PHP OperationCommand::prepare怎么用?PHP OperationCommand::prepare使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Guzzle\Service\Command\OperationCommand的用法示例。


在下文中一共展示了OperationCommand::prepare方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: prepare

 public function prepare()
 {
     $request = parent::prepare();
     if (null !== ($url = $this->get('url'))) {
         $request->setUrl($url);
     }
     return $request;
 }
开发者ID:smaft-sarl,项目名称:okta-php-sdk,代码行数:8,代码来源:ListUserCommand.php

示例2: prepare

 /**
  * add the template variables to the query part
  *
  * @return \Guzzle\Http\Message\RequestInterface
  */
 public function prepare()
 {
     $request = parent::prepare();
     $url = $request->getUrl(true);
     $query = $url->getQuery();
     $query->merge($this->templateVariables);
     $request->setUrl($url);
     return $request;
 }
开发者ID:aaannndddyyy,项目名称:cinderella-sdk,代码行数:14,代码来源:Fetch.php

示例3: testAddsContentTypeWhenExpectsIsSetOnCommand

 public function testAddsContentTypeWhenExpectsIsSetOnCommand()
 {
     $op = new OperationCommand(array(), new Operation());
     $op['command.expects'] = 'application/json';
     $op->setClient(new Client());
     $request = $op->prepare();
     $request->setResponse(new Response(200, null, '{"Baz":"Bar"}'), true);
     $this->assertEquals(array('Baz' => 'Bar'), $op->execute());
 }
开发者ID:Frinstio,项目名称:AlfredWorkflow.com,代码行数:9,代码来源:DefaultResponseParserTest.php

示例4: testAllowsRawResponses

 public function testAllowsRawResponses()
 {
     $description = new ServiceDescription(array('operations' => array('foo' => array('responseClass' => 'bar', 'responseType' => 'model')), 'models' => array('bar' => array())));
     $op = new OperationCommand(array(OperationCommand::RESPONSE_PROCESSING => OperationCommand::TYPE_RAW), $description->getOperation('foo'));
     $op->setClient(new Client());
     $request = $op->prepare();
     $response = new Response(200, array('Content-Type' => 'application/xml'), '<Foo><Baz>Bar</Baz></Foo>');
     $request->setResponse($response, true);
     $this->assertSame($response, $op->execute());
 }
开发者ID:jorjoh,项目名称:Varden,代码行数:10,代码来源:OperationCommandTest.php

示例5: testSkipsUnkownModels

 public function testSkipsUnkownModels()
 {
     $parser = new OperationResponseParser();
     $operation = $this->getDescription()->getOperation('test');
     $operation->setResponseClass('Baz')->setResponseType('model');
     $op = new OperationCommand(array(), $operation);
     $op->setResponseParser($parser)->setClient(new Client());
     $op->prepare()->setResponse(new Response(201), true);
     $this->assertInstanceOf('Guzzle\\Http\\Message\\Response', $op->execute());
 }
开发者ID:xkeygmbh,项目名称:ifresco-php,代码行数:10,代码来源:OperationResponseParserTest.php

示例6: testDoesNotParseXmlWhenNotUsingXmlVisitor

 public function testDoesNotParseXmlWhenNotUsingXmlVisitor()
 {
     $parser = OperationResponseParser::getInstance();
     $description = ServiceDescription::factory(array('operations' => array('test' => array('responseClass' => 'Foo')), 'models' => array('Foo' => array('type' => 'object', 'properties' => array('baz' => array('location' => 'body'))))));
     $operation = $description->getOperation('test');
     $op = new OperationCommand(array(), $operation);
     $op->setResponseParser($parser)->setClient(new Client());
     $brokenXml = '<broken><><><<xml>>>>>';
     $op->prepare()->setResponse(new Response(200, array('Content-Type' => 'application/xml'), $brokenXml), true);
     $result = $op->execute();
     $this->assertEquals(array('baz'), $result->getKeys());
     $this->assertEquals($brokenXml, (string) $result['baz']);
 }
开发者ID:KANU82,项目名称:guzzle,代码行数:13,代码来源:OperationResponseParserTest.php

示例7: testAdditionalPropertiesWithRefAreResolved

 /**
  * @group issue-399
  * @link https://github.com/guzzle/guzzle/issues/501
  */
 public function testAdditionalPropertiesWithRefAreResolved()
 {
     $parser = OperationResponseParser::getInstance();
     $description = ServiceDescription::factory(array('operations' => array('test' => array('responseClass' => 'Foo')), 'models' => array('Baz' => array('type' => 'string'), 'Foo' => array('type' => 'object', 'additionalProperties' => array('$ref' => 'Baz', 'location' => 'json')))));
     $operation = $description->getOperation('test');
     $op = new OperationCommand(array(), $operation);
     $op->setResponseParser($parser)->setClient(new Client());
     $json = '{"a":"a","b":"b","c":"c"}';
     $op->prepare()->setResponse(new Response(200, array('Content-Type' => 'application/json'), $json), true);
     $result = $op->execute()->toArray();
     $this->assertEquals(array('a' => 'a', 'b' => 'b', 'c' => 'c'), $result);
 }
开发者ID:rahilmomin,项目名称:ci_bootstrap_3,代码行数:16,代码来源:OperationResponseParserTest.php

示例8: testEnsuresResponseClassImplementsResponseClassInterface

 /**
  * @expectedException \Guzzle\Service\Exception\ResponseClassException
  * @expectedExceptionMessage and implement
  */
 public function testEnsuresResponseClassImplementsResponseClassInterface()
 {
     $parser = OperationResponseParser::getInstance();
     $description = ServiceDescription::factory(array('operations' => array('test' => array('responseClass' => __CLASS__))));
     $operation = $description->getOperation('test');
     $op = new OperationCommand(array(), $operation);
     $op->setResponseParser($parser)->setClient(new Client());
     $op->prepare()->setResponse(new Response(200, array('Content-Type' => 'application/json'), 'hi!'), true);
     $op->execute();
 }
开发者ID:mickdane,项目名称:zidisha,代码行数:14,代码来源:OperationResponseParserTest.php


注:本文中的Guzzle\Service\Command\OperationCommand::prepare方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。