public function testVoucherTypeSuccess()
 {
     $oVoucher = new VoucherType();
     $iVoucherTypeId = 1;
     $sName = 'test voucher';
     $sSlugName = 'test_voucher';
     $sDescription = 'A sucessful test voucher';
     $oEnableFrom = new DateTime();
     $oEnableTo = new DateTime('NOW + 5 days');
     $iVoucherGroupId = 1;
     $iVoucherGenRuleId = 1;
     $oVoucher->setVoucherTypeId($iVoucherTypeId);
     $oVoucher->setSlug($sSlugName);
     $oVoucher->setName($sName);
     $oVoucher->setDescription($sDescription);
     $oVoucher->setEnabledFrom($oEnableFrom);
     $oVoucher->setEnabledTo($oEnableTo);
     $oVoucher->setVoucherGroupId($iVoucherGroupId);
     $oVoucher->setVoucherGenruleId($iVoucherGenRuleId);
     $this->assertEquals($iVoucherTypeId, $oVoucher->getVoucherTypeId());
     $this->assertEquals($sName, $oVoucher->getName());
     $this->assertEquals($sSlugName, $oVoucher->getSlug());
     $this->assertEquals($sDescription, $oVoucher->getDescription());
     $this->assertEquals($oEnableFrom, $oVoucher->getEnabledFrom());
     $this->assertEquals($oEnableTo, $oVoucher->getEnabledTo());
     $this->assertEquals($iVoucherGroupId, $oVoucher->getVoucherGroupID());
     $this->assertEquals($iVoucherGenRuleId, $oVoucher->getVoucherGenRuleId());
     $this->assertTrue($oVoucher->validate());
     # id not required to validate
     $oVoucher = new VoucherType();
     $oVoucher->setSlug($sSlugName);
     $oVoucher->setName($sName);
     $oVoucher->setDescription($sDescription);
     $oVoucher->setEnabledFrom($oEnableFrom);
     $oVoucher->setEnabledTo($oEnableTo);
     $oVoucher->setVoucherGroupId($iVoucherGroupId);
     $oVoucher->setVoucherGenruleId($iVoucherGenRuleId);
     $this->assertTrue($oVoucher->validate());
 }
 /**
  *  Convert and entity into a data array that match database columns in table
  *
  *  @return array
  *  @access public
  *  @param VoucherType    $entity A voucher type entity
  */
 public function demolish($entity)
 {
     $aData = array('voucher_type_id' => $entity->getVoucherTypeId(), 'voucher_enabled_from' => $entity->getEnabledFrom(), 'voucher_enabled_to' => $entity->getEnabledTo(), 'voucher_name' => $entity->getName(), 'voucher_name_slug' => $entity->getSlug(), 'voucher_description' => $entity->getDescription(), 'voucher_group_id' => $entity->getVoucherGroupId(), 'voucher_gen_rule_id' => $entity->getVoucherGenRuleId());
     return $aData;
 }