public function testAlreadyOverriddenUserAgent()
 {
     $_SERVER['REMOTE_ADDR'] = '1.2.3.4';
     $command = new OperationCommand();
     $command->set('uip', '4.3.2.1');
     $this->dispatchCommand($command);
     $this->assertSame('4.3.2.1', $command->get('uip'));
 }
 public function testAlreadyOverriddenUserAgent()
 {
     $_SERVER['HTTP_USER_AGENT'] = 'Opera/9.80 (Windows NT 6.0) Presto/2.12.388 Version/12.14';
     $command = new OperationCommand();
     $command->set('ua', 'some_value');
     $this->dispatchCommand($command);
     $this->assertSame('some_value', $command->get('ua'));
 }
 public function testUsesNativeResultWhenInstructed()
 {
     $parser = new OperationResponseParser();
     $op = new OperationCommand(array(), $this->getDescription()->getOperation('test'));
     $op->setResponseParser($parser)->setClient(new Client());
     $op->prepare()->setResponse(new Response(200, array('Content-Type' => 'application/xml'), '<F><B>C</B></F>'), true);
     $op->set(AbstractCommand::RESPONSE_PROCESSING, 'native');
     $this->assertInstanceOf('SimpleXMLElement', $op->execute());
 }
 public function testForceSet()
 {
     $plugin = new DataSetter(array('test_key' => 'test_value'), true);
     $command = new OperationCommand();
     $command->set('test_key', 'already_stated_value');
     $event = new Event(array('command' => $command));
     $plugin->register($this->client);
     $this->client->getEventDispatcher()->dispatch('command.before_prepare', $event);
     $this->assertSame('test_value', $command->get('test_key'));
 }