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


PHP OperationCommand::setClient方法代码示例

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


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

示例1: getCommandWithArrayParamAndFilters

 protected function getCommandWithArrayParamAndFilters()
 {
     $operation = new Operation(array('httpMethod' => 'POST', 'parameters' => array('foo' => new Parameter(array('type' => 'string', 'location' => 'query', 'sentAs' => 'Foo', 'required' => true, 'default' => 'bar', 'filters' => array('strtoupper'))), 'arr' => new Parameter(array('type' => 'array', 'location' => 'query', 'sentAs' => 'Arr', 'required' => true, 'default' => array(123, 456, 789), 'filters' => array(array('method' => 'implode', 'args' => array(',', '@value'))))))));
     $command = new OperationCommand(array(), $operation);
     $command->setClient(new MockClient());
     return $command;
 }
开发者ID:Frinstio,项目名称:AlfredWorkflow.com,代码行数:7,代码来源:AbstractVisitorTestCase.php

示例2: testCastPrimitivesToArrays

 /**
  * @covers Desk\Command\PreValidator::castPrimitivesToArrays
  * @dataProvider dataCastPrimitivesToArrays
  *
  * @param array $param    Parameter description/structure
  * @param mixed $value    Input value for the parameter
  * @param mixed $expected Expected output value
  */
 public function testCastPrimitivesToArrays(array $param, $value, $expected)
 {
     $command = new OperationCommand(array('foo' => $value), new Operation(array('parameters' => array('foo' => $param))));
     $command->setClient(new Client());
     $event = new Event(array('command' => $command));
     $preValidator = $this->mock('castPrimitivesToArrays');
     $preValidator->castPrimitivesToArrays($event);
     $this->assertSame($expected, $command->get('foo'));
 }
开发者ID:dh-open,项目名称:desk-php,代码行数:17,代码来源:PreValidatorTest.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: getCommand

 protected function getCommand($location)
 {
     $command = new OperationCommand(array(), $this->getNestedCommand($location));
     $command->setClient(new MockClient());
     return $command;
 }
开发者ID:xkeygmbh,项目名称:ifresco-php,代码行数:6,代码来源:AbstractVisitorTestCase.php


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