//// Totals $t->is($cm->getItemsCharge(), 280, '::getItemsCharge() returns the correct value'); $t->is($cm->getSubTotal(), 280, '::getSubTotal() returns the correct value'); $t->is($cm->getPreTotalCharge(), 300, '::getPreTotalCharge() returns the correct value'); $t->is($cm->getTotalCharge(), 300, '::getTotalCharge() returns the correct value'); $t->diag('4.7.3 Use valid voucher *****************************************************'); // Clean order and reset cart manager unset($cm); rtShopOrderTestTools::cleanOrder(); $cm = new rtShopCartManager(); // Add stocks to cart manager $cm->addToCart($stock1, 1); $cm->addToCart($stock2, 1); // Voucher $cm->setVoucherCode($voucher2->getCode()); $t->is($cm->getVoucherCode(), $voucher2->getCode(), '::getVoucherCode() returns correct voucher code'); $t->is($cm->getVoucherReduction(), 10, '::getVoucherReduction() returns correct voucher reduction'); //// Totals $t->is($cm->getItemsCharge(), 280, '::getItemsCharge() returns the correct value'); $t->is($cm->getSubTotal(), 280, '::getSubTotal() returns the correct value'); $t->is($cm->getPreTotalCharge(), 300, '::getPreTotalCharge() returns the correct value'); $t->is($cm->getTotalCharge(), 290, '::getTotalCharge() returns the correct value'); /** * rtShopOrderTestTools Class */ class rtShopOrderTestTools { /** * Make sure table is cleaned before testing */ public static function clean()
// ItemsCharge $t->is($cm->getItemsCharge(), 470, 'ItemsCharge: ' . format_currency($cm->getItemsCharge(), sfConfig::get('app_rt_currency', 'USD'))); // SubTotal $t->is($cm->getSubTotal(), 470, 'SubTotal: ' . format_currency($cm->getSubTotal(), sfConfig::get('app_rt_currency', 'USD'))); $t->comment('-----------------------------------------------------------------------------'); // Promotion $t->is($cm->getPromotionReduction(), 47.0, 'Promotion: -' . format_currency($cm->getPromotionReduction(), sfConfig::get('app_rt_currency', 'USD'))); // Shipping $t->is($cm->getShippingCharge(), 10, 'Shipping: ' . format_currency($cm->getShippingCharge(), sfConfig::get('app_rt_currency', 'USD'))); $t->comment('-----------------------------------------------------------------------------'); // Pre total $t->is($cm->getPreTotalCharge(), 433.0, 'PreTotal: ' . format_currency($cm->getPreTotalCharge(), sfConfig::get('app_rt_currency', 'USD'))); $t->comment('-----------------------------------------------------------------------------'); // Voucher $cm->setVoucherCode($voucher1->getCode()); $t->is($cm->getVoucherReduction(), 10, 'Voucher: -' . format_currency($cm->getVoucherReduction(), sfConfig::get('app_rt_currency', 'USD')) . ' (#' . $cm->getVoucherCode() . ')'); $t->comment('============================================================================='); // Total $t->is($cm->getTotalCharge(), 423.0, 'Total (includes $' . format_currency($cm->getTaxComponent(), sfConfig::get('app_rt_currency', 'USD')) . ' tax): ' . format_currency($cm->getTotalCharge(), sfConfig::get('app_rt_currency', 'USD'))); $t->comment('============================================================================='); /** * rtShopComplexOrder1TestTools Class */ class rtShopComplexOrder1TestTools { /** * Make sure table is cleaned before testing */ public static function clean() { $doctrine = Doctrine_Manager::getInstance()->getCurrentConnection()->getDbh();