/**
  * Return array with the data to be serialized
  * @return array
  */
 public function getSerializerData()
 {
     $objectArray = new ObjectArray();
     $objectArray->append(new NonRecursiveJsonRequest());
     $objectArray->append(new NonRecursiveJsonRequest());
     return array('test' => 1, 'test2' => 2, 'arrayValue' => $objectArray);
 }
Esempio n. 2
0
 public function testRecursiveArrayValidation()
 {
     $validation = new Validation();
     $request = new ValidateRecursiveArrayRequest();
     /**
      * Ok put an error on one of the elements
      */
     $array = new ObjectArray();
     $subRequestObject = new ValidateNonRecursiveRequest();
     $subRequestObject->setData("test", "foo");
     $array->append($subRequestObject);
     $request->setData("testArray", $array);
     $validation->getValidator($request);
     $data = $validation->performValidation();
     $expected = array('Upg\\Library\\Tests\\Mock\\Request\\ValidateNonRecursiveRequest' => array('test' => array(0 => 'Test must be an integer')));
     $this->assertEquals($expected, $data, "Validation data not as expected");
 }
Esempio n. 3
0
 /**
  * Add hosted Page Tex object to the request
  * @see CreateTransaction::hostedPagesTexts
  * @see HostedPagesText
  * @param HostedPagesText $hostedPagesText
  * @return $this
  */
 public function setHostedPagesTexts(HostedPagesText $hostedPagesText)
 {
     if (empty($this->hostedPagesTexts)) {
         $this->hostedPagesTexts = new ObjectArray();
     }
     $this->hostedPagesTexts->append($hostedPagesText);
     return $this;
 }