本文整理汇总了PHP中Guzzle\Service\Client::execute方法的典型用法代码示例。如果您正苦于以下问题:PHP Client::execute方法的具体用法?PHP Client::execute怎么用?PHP Client::execute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Guzzle\Service\Client
的用法示例。
在下文中一共展示了Client::execute方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testValidatesArgs
/**
* @covers Guzzle\Service\Command\DynamicCommand
* @expectedException Guzzle\Service\Exception\ValidationException
*/
public function testValidatesArgs()
{
$client = new Client('http://www.fragilerock.com/');
$client->setDescription($this->service);
$command = $this->factory->factory('test_command', array());
$client->execute($command);
}
示例2: executeCommand
/**
* @param $command
* @param array $arguments
*
* @return array
*/
public function executeCommand($command, $arguments = array())
{
$command = $this->client->getCommand($command, $arguments);
return $this->client->execute($command);
/*$command->getResponse()->json();*/
}
示例3: testThrowsExceptionWhenInvalidCommandIsExecuted
/**
* @expectedException Guzzle\Common\Exception\InvalidArgumentException
*/
public function testThrowsExceptionWhenInvalidCommandIsExecuted()
{
$client = new Client();
$client->execute(new \stdClass());
}
示例4: testExecutesCommandSets
/**
* @covers Guzzle\Service\Client::execute
*/
public function testExecutesCommandSets()
{
$client = new Client('http://www.test.com/');
$client->getEventDispatcher()->addSubscriber(new MockPlugin(array(new Response(200))));
// Create a command set and a command
$set = new CommandSet();
$cmd = new MockCommand();
$set->addCommand($cmd);
$this->assertSame($set, $client->execute($set));
// Make sure it sent
$this->assertTrue($cmd->isExecuted());
$this->assertTrue($cmd->isPrepared());
$this->assertEquals(200, $cmd->getResponse()->getStatusCode());
}