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); try { $i1 = new rtShopVoucher(); $i1->save(); $t->fail('->save() rtShopVoucher allows empty saves'); $i1->delete(); } catch (Exception $e) { $t->pass('->save() rtShopVoucher 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 rtShopPromotionCart object works'); } catch (Exception $e) { $t->fail('->save() on a rtShopPromotionCart failed!'); } $o1 = Doctrine::getTable('rtShopPromotionCart')->find($i3->getId()); $t->isa_ok($o1, 'rtShopPromotionCart', '->retrieve() rtShopPromotionCart object was saved to database and retrieved successfully'); $o2 = Doctrine::getTable('rtShopPromotionCart')->findAvailable(70, NULL); $t->is(count($o2), 1, '::findAvailable() retrieved 1 object successfully'); // Clean up $i3->delete(); $i4->delete(); unset($o1, $o2); /** * rtShopPromotionToolkit Class */ class rtShopPromotionTestTools { /** * Make sure table is cleaned before testing */ public static function clean() { $doctrine = Doctrine_Manager::getInstance()->getCurrentConnection()->getDbh(); $doctrine->query('TRUNCATE table rt_shop_promotion'); unset($doctrine); }