public function testMergesDefaultCommandParamsCorrectly()
 {
     $client = new Mock\MockClient('http://www.foo.com', array(Client::COMMAND_PARAMS => array('mesa' => 'bar', 'jar' => 'jar')));
     $command = $client->getCommand('mock_command', array('jar' => 'test'));
     $this->assertEquals('bar', $command->get('mesa'));
     $this->assertEquals('test', $command->get('jar'));
 }
 /**
  * @covers Guzzle\Service\Client::getCommand
  * @depends testMagicCallBehaviorExecuteExecutesCommands
  */
 public function testEnablesMagicMethodCallsOnCommandsIfEnabledOnClient()
 {
     $client = new Mock\MockClient();
     $command = $client->getCommand('other_command');
     $this->assertNull($command->get('command.magic_method_call'));
     $client->setMagicCallBehavior(Client::MAGIC_CALL_EXECUTE);
     $command = $client->getCommand('other_command');
     $this->assertTrue($command->get('command.magic_method_call'));
 }
Пример #3
0
 /**
  * @covers Guzzle\Service\Client::execute
  */
 public function testClientResetsRequestsBeforeExecutingCommands()
 {
     $this->getServer()->flush();
     $this->getServer()->enqueue(array("HTTP/1.1 200 OK\r\nContent-Length: 2\r\n\r\nHi", "HTTP/1.1 200 OK\r\nContent-Length: 1\r\n\r\nI"));
     $client = new Mock\MockClient($this->getServer()->getUrl());
     $command = $client->getCommand('mock_command');
     $client->execute($command);
     $client->execute($command);
     $this->assertEquals('I', $command->getResponse()->getBody(true));
 }
Пример #4
0
 public function testGetCommandAfterTwoSetDescriptions()
 {
     $service1 = ServiceDescription::factory(__DIR__ . '/../TestData/test_service.json');
     $service2 = ServiceDescription::factory(__DIR__ . '/../TestData/test_service_3.json');
     $client = new Mock\MockClient();
     $client->setDescription($service1);
     $client->getCommand('foo_bar');
     $client->setDescription($service2);
     $client->getCommand('baz_qux');
 }