Example #1
0
 public function testAmountTestValidationVatRateFailure()
 {
     $validation = new Validation();
     $amount = new Amount();
     $amount->setAmount(99);
     $amount->setVatRate("string");
     $validation->getValidator($amount);
     $data = $validation->performValidation();
     $expected = array('Upg\\Library\\Request\\Objects\\Amount' => array('vatRate' => array(0 => 'VatRate must be an number', 1 => 'VatRate must be 1 to 2 digits followed by 1 to 2 decimal place')));
     $this->assertEquals($expected, $data, 'Number validation not triggered the vatRate');
     $amount->setVatRate(78.254);
     $validation->getValidator($amount);
     $data = $validation->performValidation();
     $expected = array('Upg\\Library\\Request\\Objects\\Amount' => array('vatRate' => array(0 => 'VatRate must be 1 to 2 digits followed by 1 to 2 decimal place')));
     $this->assertEquals($expected, $data, 'Float validation not triggered the vatRate');
 }
Example #2
0
 /**
  * @param Processor $processor
  * @param $value
  * @return AmountClass
  */
 public function unserializeProperty(Processor $processor, $value)
 {
     $amount = new AmountClass();
     $amount->setUnserializedData($value);
     return $amount;
 }
Example #3
0
 private function getBasketItemAmount()
 {
     $amount = new Amount();
     $amount->setAmount(9200)->setVatAmount(1840)->setVatRate(20);
     return $amount;
 }