$i6->save(); $i7 = new rtShopVoucher(); $i7->setTitle('Voucher'); $i7->setCode($code5); $i7->setDateFrom(date('Y-m-d H:i:s', strtotime(sprintf("-%s months", 3)))); $i7->setDateTo(date('Y-m-d H:i:s', strtotime(sprintf("+%s months", 1)))); $i7->setTotalFrom(150); $i7->setTotalTo(250); $i7->setReductionType('percentageOff'); $i7->setReductionValue(12); $i7->setMode('Single'); $i7->setCount(1); $i7->save(); $i8 = new rtShopVoucher(); $i8->setTitle('Voucher'); $i8->setCode($code6); $i8->setDateFrom(date('Y-m-d H:i:s', strtotime(sprintf("-%s months", 3)))); $i8->setDateTo(date('Y-m-d H:i:s', strtotime(sprintf("+%s months", 1)))); $i8->setTotalFrom(250); $i8->setTotalTo(400); $i8->setReductionType('percentageOff'); $i8->setReductionValue(12); $i8->setMode('Single'); $i8->setCount(0); $i8->save(); $t->pass('->save() on a rtShopVoucher object works'); } catch (Exception $e) { $t->fail('->save() on a rtShopVoucher failed!'); } $t->diag('Get applicable voucher based on count, total and date'); $voucher = rtShopVoucherToolkit::getApplicable($code4, 130, date("Y-m-d H:i:s"));