コード例 #1
0
$t->is($cm->getShippingCharge(), 10, 'Shipping:     ' . format_currency($cm->getShippingCharge(), sfConfig::get('app_rt_currency', 'USD')));
$t->comment('-----------------------------------------------------------------------------');
// Pre total
$t->is($cm->getPreTotalCharge(), 164.0, 'PreTotal:    ' . format_currency($cm->getPreTotalCharge(), sfConfig::get('app_rt_currency', 'USD')));
$t->comment('=============================================================================');
// Total
$t->is($cm->getTotalCharge(), 164.0, 'Total:       ' . format_currency($cm->getTotalCharge(), sfConfig::get('app_rt_currency', 'USD')));
$t->comment('=============================================================================');
$t->comment('');
$t->diag('***************************************');
$t->diag('*** Voucher check');
$t->diag('***************************************');
$t->comment('');
$t->comment('--- BasertShopOrderActions::executeCheckVoucher() // dollarOff ----------------------------------------');
$t->diag('*** Case #1.0: Voucher #1: Non-applicable voucher');
$check_voucher_array1 = $cm->getCheckVoucherArray($voucher1->getCode());
$t->is($check_voucher_array1['error'], true, '->checkVoucher() has no applicable rtShopVoucher.');
$t->diag('*** Case #1.1: Voucher #2: Applicable voucher');
$check_voucher_array2 = $cm->getCheckVoucherArray($voucher2->getCode());
$t->is($check_voucher_array2['error'], false, '->checkVoucher() has applicable rtShopVoucher where code #' . $voucher2->getCode());
$t->comment('--- BasertShopOrderActions::executeCheckVoucher() // percentageOff ------------------------------------');
$t->diag('*** Case #1.2: Voucher #3: Non-applicable voucher');
$check_voucher_array3 = $cm->getCheckVoucherArray($voucher3->getCode());
$t->is($check_voucher_array3['error'], true, '->checkVoucher() has no applicable rtShopVoucher.');
$t->diag('*** Case #1.3: Voucher #4: Applicable voucher');
$check_voucher_array4 = $cm->getCheckVoucherArray($voucher4->getCode());
$t->is($check_voucher_array4['error'], false, '->checkVoucher() has applicable rtShopVoucher where code #' . $voucher4->getCode());
$t->comment('--- rtShopCartManager::getVoucherReduction() // dollarOff ---------------------------------------------');
$t->diag('*** Case #2.0: Voucher #1: Non-applicable voucher');
$cm->setVoucherCode($voucher1->getCode());
$t->is($cm->getVoucherReduction(), 0, '->getVoucherReduction() is returning correct voucher reduction value of ' . $numberFormat->format($cm->getVoucherReduction(), 'c', sfConfig::get('app_rt_currency', 'USD')) . ')');