Skip to content
Snippets Groups Projects
Commit 43b402f6 authored by Maxime Kohlhaas's avatar Maxime Kohlhaas
Browse files

fix phpunit test with new multicurrency return value pu_ht_devise

parent 5233c65a
Branches
Tags
No related merge requests found
......@@ -151,7 +151,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result1=calcul_price_total(1, 1.24, 0, 10, 0, 0, 0, 'HT', 0, 0);
print __METHOD__." result1=".join(', ',$result1)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(1.24, 0.12, 1.36, 1.24, 0.124, 1.364, 1.24, 0.12, 1.36, 0, 0, 0, 0, 0, 0, 0, 1.24, 0.12, 1.36),$result1,'Test1 FR');
$this->assertEquals(array(1.24, 0.12, 1.36, 1.24, 0.124, 1.364, 1.24, 0.12, 1.36, 0, 0, 0, 0, 0, 0, 0, 1.24, 0.12, 1.36, 1.24),$result1,'Test1 FR');
// qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT', multicurrency_tx=1.09205 (method we provide value)
$mysoc->country_code='FR';
......@@ -159,7 +159,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result1=calcul_price_total(2, 8.56, 0, 10, 0, 0, 0, 'HT', 0, 0, '', '', 100, 1.09205);
print __METHOD__." result1=".join(', ',$result1)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(17.12, 1.71, 18.83, 8.56, 0.856, 9.416, 17.12, 1.71, 18.83, 0, 0, 0, 0, 0, 0, 0, 18.7, 1.87, 20.56),$result1,'Test1 FR');
$this->assertEquals(array(17.12, 1.71, 18.83, 8.56, 0.856, 9.416, 17.12, 1.71, 18.83, 0, 0, 0, 0, 0, 0, 0, 18.7, 1.87, 20.56, 9.34795),$result1,'Test1 FR');
/*
......@@ -174,7 +174,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result2=calcul_price_total(10, 10, 0, 10, 0, 0, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1, 0% localtax2
print __METHOD__." result2=".join(', ',$result2)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110),$result2,'Test1 ES');
$this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110, 10),$result2,'Test1 ES');
// 10 * 10 HT - 0% discount with 10% vat, seller not using localtax1, not localtax2 (other method autodetect)
$mysoc->country_code='ES';
......@@ -184,7 +184,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1, 0% localtax2
print __METHOD__." result2=".join(', ',$result2)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110),$result2,'Test2 ES');
$this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110, 10),$result2,'Test2 ES');
// --------------------------------------------------------
......@@ -196,7 +196,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result2=calcul_price_total(10, 10, 0, 10, 1.4, 0, 0, 'HT', 0, 0);
print __METHOD__." result2=".join(', ',$result2)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0, 100, 10, 111.4),$result2,'Test3 ES');
$this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0, 100, 10, 111.4, 10),$result2,'Test3 ES');
// 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1 type 3, 0% localtax2 type 5 (other method autodetect)
$mysoc->country_code='ES';
......@@ -206,7 +206,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0);
print __METHOD__." result2=".join(', ',$result2)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0, 100, 10, 111.4),$result2,'Test4 ES');
$this->assertEquals(array(100, 10, 111.4, 10, 1, 11.14, 100, 10, 111.4, 1.4, 0, 0.14, 0, 0, 1.4, 0, 100, 10, 111.4, 10),$result2,'Test4 ES');
// --------------------------------------------------------
......@@ -217,7 +217,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$mysoc->localtax2_assuj=1;
$result2=calcul_price_total(10, 10, 0, 10, 0, -19, 0, 'HT', 0, 1);
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19, 0, -1.90, 0, 0, -19, 100, 10, 91),$result2,'Test5 ES for service');
$this->assertEquals(array(100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19, 0, -1.90, 0, 0, -19, 100, 10, 91, 10),$result2,'Test5 ES for service');
// 10 * 10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 21% localtax2 type 5 (other method autodetect), we provide a service and not a product
$mysoc->country_code='ES';
......@@ -227,7 +227,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 0);
print __METHOD__." result2=".join(', ',$result2)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110),$result2,'Test6 ES for product');
$this->assertEquals(array(100, 10, 110, 10, 1, 11, 100, 10, 110, 0, 0, 0, 0, 0, 0, 0, 100, 10, 110, 10),$result2,'Test6 ES for product');
// 10 * 10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 21% localtax2 type 5 (other method autodetect), we provide a product and not a service
$mysoc->country_code='ES';
......@@ -237,7 +237,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result2=calcul_price_total(10, 10, 0, 10, -1, -1, 0, 'HT', 0, 1);
print __METHOD__." result2=".join(', ',$result2)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19, 0, -1.90, 0, 0, -19, 100, 10, 91),$result2,'Test6 ES for service');
$this->assertEquals(array(100, 10, 91, 10, 1, 9.1, 100, 10, 91, 0, -19, 0, -1.90, 0, 0, -19, 100, 10, 91, 10),$result2,'Test6 ES for service');
// --------------------------------------------------------
......@@ -249,7 +249,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result2=calcul_price_total(10, -10, 0, 10, 0, 19, 0, 'HT', 0, 0);
print __METHOD__." result2=".join(', ',$result2)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(-100, -10, -110, -10, -1, -11, -100, -10, -110, 0, 0, 0, 0, 0, 0, 0, -100, -10, -110),$result2,'Test7 ES for product');
$this->assertEquals(array(-100, -10, -110, -10, -1, -11, -100, -10, -110, 0, 0, 0, 0, 0, 0, 0, -100, -10, -110, -10),$result2,'Test7 ES for product');
// Credit Note: 10 * -10 HT - 0% discount with 10% vat and 1.4% localtax1 type 3, 0% localtax2 type 5 (other method autodetect), we provide a service and not a product
$mysoc->country_code='ES';
......@@ -258,7 +258,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$mysoc->localtax2_assuj=1;
$result2=calcul_price_total(10, -10, 0, 10, -1, -1, 0, 'HT', 0, 1);
print __METHOD__." result2=".join(', ',$result2)."\n";
$this->assertEquals(array(-100, -10, -91, -10, -1, -9.1, -100, -10, -91, 0, 19, 0, 1.90, 0, 0, 19, -100, -10, -91),$result2,'Test8 ES for service');
$this->assertEquals(array(-100, -10, -91, -10, -1, -9.1, -100, -10, -91, 0, 19, 0, 1.90, 0, 0, 19, -100, -10, -91, -10),$result2,'Test8 ES for service');
/*
......@@ -275,7 +275,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result3=calcul_price_total(10, 10, 0, 18, 7.5, 0, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2
print __METHOD__." result3=".join(', ',$result3)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0, 0.885, 0, 0, 8.85, 0, 100, 18, 126.85),$result3,'Test9 CI');
$this->assertEquals(array(100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0, 0.885, 0, 0, 8.85, 0, 100, 18, 126.85, 10),$result3,'Test9 CI');
// 10 * 10 HT - 0% discount with 18% vat, seller using localtax1 type 2, not localtax2 (other method autodetect)
$mysoc->country_code='CI';
......@@ -285,7 +285,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
$result3=calcul_price_total(10, 10, 0, 18, -1, -1, 0, 'HT', 0, 0); // 10 * 10 HT - 0% discount with 18% vat and 7.5% localtax1, 0% localtax2
print __METHOD__." result3=".join(', ',$result3)."\n";
// result[0,1,2,3,4,5,6,7,8] (total_ht, total_vat, total_ttc, pu_ht, pu_tva, pu_ttc, total_ht_without_discount, total_vat_without_discount, total_ttc_without_discount)
$this->assertEquals(array(100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0, 0.885, 0, 0, 8.85, 0, 100, 18, 126.85),$result3,'Test10 CI');
$this->assertEquals(array(100, 18, 126.85, 10, 1.8, 12.685, 100, 18, 126.85, 8.85, 0, 0.885, 0, 0, 8.85, 0, 100, 18, 126.85, 10),$result3,'Test10 CI');
return true;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment