fix test suite

This commit is contained in:
Manuel Raynaud
2014-02-20 11:44:09 +01:00
parent dafce9e070
commit 3ab022e99d
4 changed files with 19 additions and 6 deletions

View File

@@ -125,6 +125,12 @@ class BaseFacade implements FacadeInterface
}
public function getCartTotalTaxPrice()
{
$taxCountry = $this->getContainer()->get('thelia.taxEngine')->getDeliveryCountry();
return $this->getCart()->getTaxedAmount($taxCountry);
}
/**
* Return the Checkout currency EUR|USD
*

View File

@@ -83,6 +83,13 @@ interface FacadeInterface
*/
public function getCartTotalPrice();
/**
* Return Product total tax price
*
* @return float
*/
public function getCartTotalTaxPrice();
/**
* Return the Checkout currency EUR|USD
*

View File

@@ -103,10 +103,9 @@ class RemoveXPercent extends CouponAbstract
'Percentage must be inferior to 100'
);
}
$taxCountry = $this->facade->getContainer()->get('thelia.taxEngine')->getDeliveryCountry();
$basePrice = $this->facade->getCart()->getTaxedAmount($taxCountry);
return round($basePrice * $this->percentage/100, 2);
return round($this->facade->getCartTotalTaxPrice() * $this->percentage/100, 2);
}
/**

View File

@@ -63,14 +63,15 @@ class RemoveXPercentTest extends \PHPUnit_Framework_TestCase
->disableOriginalConstructor()
->getMock();
$currencies = CurrencyQuery::create();
$currencies = $currencies->find();
$currencies = CurrencyQuery::create()->find();
$stubFacade->expects($this->any())
->method('getAvailableCurrencies')
->will($this->returnValue($currencies));
$stubFacade->expects($this->any())
->method('getCartTotalPrice')
->method('getCartTotalTaxPrice')
->will($this->returnValue($cartTotalPrice));
$stubFacade->expects($this->any())