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()); }