/** * Convert data array into entity * * @return VoucherGroup * @param array $data * @access public */ public function build($data) { $oEntity = new VoucherInstance(); $sAlias = $this->getTableQueryAlias(); $iVoucherInstanceId = $this->getField($data, 'voucher_instance_id', $sAlias); $iVoucherTypeId = $this->getField($data, 'voucher_type_id', $sAlias); $sVoucherCode = $this->getField($data, 'voucher_code', $sAlias); $oDateCreated = $this->getField($data, 'date_created', $sAlias); $oEntity->setVoucherInstanceId($iVoucherInstanceId); $oEntity->setVoucherTypeId($iVoucherTypeId); $oEntity->setVoucherCode($sVoucherCode); $oEntity->setDateCreated($oDateCreated); return $oEntity; }
public function testVoucherInstance() { $oInstance = new VoucherInstance(); $iVoucherInstanceId = 1; $iVoucherTypeId = 1; $sVoucherCode = '00_111_00'; $oDateCreated = new DateTime(); $oInstance->setVoucherInstanceId($iVoucherInstanceId); $oInstance->setVoucherTypeId($iVoucherTypeId); $oInstance->setVoucherCode($sVoucherCode); $oInstance->setDateCreated($oDateCreated); $this->assertEquals($iVoucherInstanceId, $oInstance->getVoucherInstanceId()); $this->assertEquals($iVoucherTypeId, $oInstance->getVoucherTypeId()); $this->assertEquals($sVoucherCode, $oInstance->getVoucherCode()); $this->assertEquals($oDateCreated, $oInstance->getDateCreated()); }