當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。