예제 #1
0
 public function testMissing()
 {
     $arr = array();
     $object = new \Foundation\Form\Input($arr);
     $this->assertNull($object->get(uniqid()));
 }
예제 #2
0
 /**
  * Pick an address from a list
  * @param integer $answerId If set we are updating an existing answer
  * @param array $postData
  */
 public function do_pickAddress($answerId, $postData)
 {
     if (empty($postData['addressMoniker'])) {
         throw new \Jazzee\Exception('Tried to do QASAddress::do_pickAddress with no addressMoniker');
     }
     $qas = new \QuickAddress($this->_applicationPage->getPage()->getVar('wsdlAddress'));
     $address = $qas->getFormattedAddress("Database layout", $postData['addressMoniker']);
     $arr = $address->atAddressLines;
     $originalInput = unserialize(base64_decode($postData['originalInput']));
     $input = new \Foundation\Form\Input($postData);
     $input->set('el' . $this->_applicationPage->getPage()->getElementByFixedId(self::FID_ADDRESS1)->getId(), $arr[0]->Line);
     $input->set('el' . $this->_applicationPage->getPage()->getElementByFixedId(self::FID_ADDRESS2)->getId(), $arr[1]->Line);
     $input->set('el' . $this->_applicationPage->getPage()->getElementByFixedId(self::FID_ADDRESS3)->getId(), $originalInput->get('address3'));
     $input->set('el' . $this->_applicationPage->getPage()->getElementByFixedId(self::FID_CITY)->getId(), $arr[3]->Line);
     $input->set('el' . $this->_applicationPage->getPage()->getElementByFixedId(self::FID_STATE)->getId(), $arr[4]->Line);
     $input->set('el' . $this->_applicationPage->getPage()->getElementByFixedId(self::FID_POSTALCODE)->getId(), $arr[5]->Line);
     $input->set('el' . $this->_applicationPage->getPage()->getElementByFixedId(self::FID_COUNTRY)->getId(), $originalInput->get('countryName'));
     if (!empty($answerId)) {
         $this->updateAnswer($input, $answerId);
         $this->_controller->setVar('currentAnswerID', null);
     } else {
         $this->newAnswer($input);
     }
 }