I'm trying to get product price both excluding and including tax in EcomDev_PHPUnit.
I have a fixture based on the one provided in official manual. I've put the following between scope and eav:
config:
default/catalog/price/scope: 1 # Set price scope to website
default/tax/calculation/algorithm: UNIT_BASE_CACLULATION
default/tax/calculation/based_on: origin
default/tax/calculation/apply_tax_on: 0
default/tax/calculation/price_includes_tax: 0
default/tax/calculation/apply_after_discount: 1
default/tax/defaults/country: DE
default/tax/defaults/region: 0
default/tax/defaults/postcode: *
default/tax/display/type: 2
default/tax/sales_display/price: 1
tables:
tax/tax_class:
- class_id: 3
class_name: Retail Customer
class_type: CUSTOMER
tax/tax_calculation_rate:
- tax_calculation_rate_id: 3
tax_country_id: DE
tax_region_id: 12
tax_postcode: *
code: VAT
rate: 19
tax/tax_calculation_rule:
- tax_calculation_rule_id: 1
code: Retail Customer-VAT
priority: 1
position: 1
calculate_subtotal: 0
tax/tax_calculation:
- tax_calculation_id: 3
tax_calculation_rule_id: 1
tax_calculation_rate_id: 3
customer_tax_class_id: 3
product_tax_class_id: 3
customer/customer_group:
- customer_group_id: 1
customer_group_code: General
tax_class_id: 3
The failing part of the test is:
$finalPriceInclTax = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), true);
$finalPriceExclTax = Mage::helper('tax')->getPrice($product, $product->getFinalPrice(), false);
// Check that prices including and excluding tax are different
$this->assertNotEquals(
$finalPriceInclTax,
$finalPriceExclTax
);
In both $finalPriceInclTax and $finalPriceExclTax I'm getting the price excluding tax.
Could you please help me with this fixture? I'm obviously missing something here.
Notes:
- I would very much prefer using a fixture to setting up tax in the test itself
- I need to get both prices on the catalog level (not checkout)