Merge branch 'master' of https://github.com/thelia/thelia into coupon
* 'master' of https://github.com/thelia/thelia: (38 commits) add propel connection in transactions remove area to area_delivery_module add an area to a delivery module create shipping zone area form update readme start shipping zone management complete admin log message allow to create a new area delete area add pre/post methods in Area model display error message update area postage add missinf files remove country from area and start creating postage management add country to as area start area configuration tempalte choices access through smarty tax rule creation downgrade smarty version create all area events ...
This commit is contained in:
@@ -347,7 +347,7 @@ class OrderTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
/* check tax */
|
||||
$orderProductTaxList = $orderProduct->getOrderProductTaxes();
|
||||
foreach ($cartItem->getProduct()->getTaxRule()->getTaxDetail($validDeliveryAddress->getCountry(), $cartItem->getPrice(), $cartItem->getPromoPrice()) as $index => $tax) {
|
||||
foreach ($cartItem->getProduct()->getTaxRule()->getTaxDetail($cartItem->getProduct(), $validDeliveryAddress->getCountry(), $cartItem->getPrice(), $cartItem->getPromoPrice()) as $index => $tax) {
|
||||
$orderProductTax = $orderProductTaxList[$index];
|
||||
$this->assertEquals($tax->getAmount(), $orderProductTax->getAmount());
|
||||
$this->assertEquals($tax->getPromoAmount(), $orderProductTax->getPromoAmount());
|
||||
|
||||
@@ -126,14 +126,64 @@ class CalculatorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
$taxRulesCollection = new ObjectCollection();
|
||||
|
||||
$aProduct = ProductQuery::create()->findOne();
|
||||
if(null === $aProduct) {
|
||||
return;
|
||||
}
|
||||
|
||||
$calculator = new Calculator();
|
||||
|
||||
$rewritingUrlQuery = $this->getProperty('taxRulesCollection');
|
||||
$rewritingUrlQuery->setValue($calculator, $taxRulesCollection);
|
||||
|
||||
$product = $this->getProperty('product');
|
||||
$product->setValue($calculator, $aProduct);
|
||||
|
||||
$calculator->getTaxedPrice('foo');
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Thelia\Exception\TaxEngineException
|
||||
* @expectedExceptionCode 501
|
||||
*/
|
||||
public function testGetUntaxedPriceAndGetTaxAmountFromTaxedPriceWithNoProductLoaded()
|
||||
{
|
||||
$taxRulesCollection = new ObjectCollection();
|
||||
$taxRulesCollection->setModel('\Thelia\Model\Tax');
|
||||
|
||||
$calculator = new Calculator();
|
||||
|
||||
$rewritingUrlQuery = $this->getProperty('taxRulesCollection');
|
||||
$rewritingUrlQuery->setValue($calculator, $taxRulesCollection);
|
||||
|
||||
$calculator->getTaxAmountFromTaxedPrice(600.95);
|
||||
}
|
||||
|
||||
/**
|
||||
* @expectedException \Thelia\Exception\TaxEngineException
|
||||
* @expectedExceptionCode 507
|
||||
*/
|
||||
public function testGetUntaxedPriceAndGetTaxAmountFromTaxedPriceWithEmptyTaxRuleCollection()
|
||||
{
|
||||
$taxRulesCollection = new ObjectCollection();
|
||||
$taxRulesCollection->setModel('\Thelia\Model\Tax');
|
||||
|
||||
$aProduct = ProductQuery::create()->findOne();
|
||||
if(null === $aProduct) {
|
||||
return;
|
||||
}
|
||||
|
||||
$calculator = new Calculator();
|
||||
|
||||
$rewritingUrlQuery = $this->getProperty('taxRulesCollection');
|
||||
$rewritingUrlQuery->setValue($calculator, $taxRulesCollection);
|
||||
|
||||
$product = $this->getProperty('product');
|
||||
$product->setValue($calculator, $aProduct);
|
||||
|
||||
$calculator->getTaxAmountFromTaxedPrice(600.95);
|
||||
}
|
||||
|
||||
public function testGetTaxedPriceAndGetTaxAmountFromUntaxedPrice()
|
||||
{
|
||||
$taxRulesCollection = new ObjectCollection();
|
||||
@@ -163,11 +213,19 @@ class CalculatorTest extends \PHPUnit_Framework_TestCase
|
||||
->setVirtualColumn('taxRuleCountryPosition', 3);
|
||||
$taxRulesCollection->append($tax);
|
||||
|
||||
$aProduct = ProductQuery::create()->findOne();
|
||||
if(null === $aProduct) {
|
||||
return;
|
||||
}
|
||||
|
||||
$calculator = new Calculator();
|
||||
|
||||
$rewritingUrlQuery = $this->getProperty('taxRulesCollection');
|
||||
$rewritingUrlQuery->setValue($calculator, $taxRulesCollection);
|
||||
|
||||
$product = $this->getProperty('product');
|
||||
$product->setValue($calculator, $aProduct);
|
||||
|
||||
$taxAmount = $calculator->getTaxAmountFromUntaxedPrice(500);
|
||||
$taxedPrice = $calculator->getTaxedPrice(500);
|
||||
|
||||
@@ -211,11 +269,19 @@ class CalculatorTest extends \PHPUnit_Framework_TestCase
|
||||
->setVirtualColumn('taxRuleCountryPosition', 3);
|
||||
$taxRulesCollection->append($tax);
|
||||
|
||||
$aProduct = ProductQuery::create()->findOne();
|
||||
if(null === $aProduct) {
|
||||
return;
|
||||
}
|
||||
|
||||
$calculator = new Calculator();
|
||||
|
||||
$rewritingUrlQuery = $this->getProperty('taxRulesCollection');
|
||||
$rewritingUrlQuery->setValue($calculator, $taxRulesCollection);
|
||||
|
||||
$product = $this->getProperty('product');
|
||||
$product->setValue($calculator, $aProduct);
|
||||
|
||||
$taxAmount = $calculator->getTaxAmountFromTaxedPrice(600.95);
|
||||
$untaxedPrice = $calculator->getUntaxedPrice(600.95);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user