$t->is($cm->getTotalCharge(), 330, '::getTotalCharge() returns the correct value'); $t->diag('4.3.2 Tax mode: Inclusive *******************************************************'); sfConfig::set('app_rt_shop_tax_rate', 10); sfConfig::set('app_rt_shop_tax_mode', 'inclusive'); // Check config values $t->is(sfConfig::get('app_rt_shop_tax_rate'), 10, 'sfConfig::app_rt_shop_tax_rate was set correctly to ' . sfConfig::get('app_rt_shop_tax_rate')); $t->is(sfConfig::get('app_rt_shop_tax_mode'), 'inclusive', 'sfConfig::app_rt_shop_tax_mode was set correctly to ' . sfConfig::get('app_rt_shop_tax_mode')); // Clean order and reset cart manager unset($cm); rtShopOrderTestTools::cleanOrder(); // Add promotion price to stock 2 $stock2->setPricePromotion(NULL); $stock2->save(); $cm = new rtShopCartManager(); $t->is($cm->getTaxMode(), sfConfig::get('app_rt_shop_tax_mode'), '::getTaxMode() returns the same tax mode as sfConfig::app_rt_shop_tax_mode'); $t->is($cm->getTaxRate(), sfConfig::get('app_rt_shop_tax_rate'), '::getTaxRate() returns the same tax rate as sfConfig::app_rt_shop_tax_rate'); // Add stocks to cart manager $cm->addToCart($stock1, 1); $cm->addToCart($stock2, 1); // Check items in cart $t->is($cm->getItemsInCart(), 2, '::getItemsInCart() returns the correct number of items in cart'); $t->is($cm->getItemsQuantityInCart(), 2, '::getItemsQuantityInCart() returns the correct items quantity in cart'); $t->isa_ok($cm->getOrder(), 'rtShopOrder', '->class() rtShopOrder was created successfully'); //In inclusive mode, exclusive mode should return 0 $t->is($cm->getTaxCharge(), 0, '::getTaxCharge() returns the correct value'); // Taxes $tax_component = $cm->getTotalCharge() * 10 / ($cm->getTaxRate() + 100); $t->is($cm->getTaxComponent(), $tax_component, '::getTaxComponent() returns the correct value'); // Totals $t->is($cm->getItemsCharge(), 300, '::getItemsCharge() returns the correct value'); $t->is($cm->getSubTotal(), 300, '::getSubTotal() returns the correct value');