unset($i1); try { $i1 = new rtShopProduct(); $i1->save(); $t->pass('->save() rtShopProduct allows empty saves'); $i1->delete(); } catch (Exception $e) { $t->fail('->save() rtShopProduct throws an Exception!'); } // Clean up unset($i1); try { $i1 = new rtShopPromotionProduct(); $i1->save(); $t->fail('->save() rtShopPromotionProduct allows empty saves'); $i1->delete(); } catch (Exception $e) { $t->pass('->save() rtShopPromotionProduct throws an Exception!'); } // Clean up unset($i1); try { $i1 = new rtShopPromotionCart(); $i1->save(); $t->fail('->save() rtShopPromotionCart allows empty saves'); $i1->delete(); } catch (Exception $e) { $t->pass('->save() rtShopPromotionCart throws an Exception!'); } // Clean up unset($i1);
$i4->setReductionType('percentageOff'); $i4->setReductionValue(15); $i4->setMode('Single'); $i4->setCount(1); $i4->save(); $t->pass('->save() on a rtShopPromotionProduct object works'); } catch (Exception $e) { $t->fail('->save() on a rtShopPromotionProduct failed!'); } $o1 = Doctrine::getTable('rtShopPromotionProduct')->find($i3->getId()); $t->isa_ok($o1, 'rtShopPromotionProduct', '->retrieve() rtShopPromotionProduct object was saved to database and retrieved successfully'); $o2 = Doctrine::getTable('rtShopPromotionProduct')->findAvailable(8, NULL); $t->is(count($o2), 1, '::findAvailable() retrieved 1 object successfully'); // Clean up $i3->delete(); $i4->delete(); unset($o1, $o2); $t->diag('***********************'); $t->diag('*** Promotion: Cart ***'); $t->diag('***********************'); // Add vouchers data try { rtShopPromotionTestTools::clean(); // Add 3 vouchers $i3 = new rtShopPromotionCart(); $i3->setTitle('Voucher'); $i3->setDateFrom(date('Y-m-d H:i:s', strtotime(sprintf("-%s months", 3)))); $i3->setDateTo(date('Y-m-d H:i:s', strtotime(sprintf("+%s months", 1)))); $i3->setTotalFrom(150); $i3->setTotalTo(250); $i3->setReductionType('dollarOff');