/** * @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); }
/** * @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();*/ }
/** * @expectedException Guzzle\Common\Exception\InvalidArgumentException */ public function testThrowsExceptionWhenInvalidCommandIsExecuted() { $client = new Client(); $client->execute(new \stdClass()); }
/** * @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()); }