forked from Wavyzz/dolibarr
Fix test for es
This commit is contained in:
@@ -139,7 +139,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
/*
|
||||
* Country France
|
||||
*/
|
||||
|
||||
|
||||
// qty=1, unit_price=1.24, discount_line=0, vat_rate=10, price_base_type='HT' (method we provide value)
|
||||
$mysoc->country_code='FR';
|
||||
$mysoc->country_id=1;
|
||||
@@ -148,11 +148,11 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
// 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),$result1,'Test1 FR');
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Country Spain
|
||||
*/
|
||||
|
||||
|
||||
// 10 * 10 HT - 0% discount with 10% vat, seller not using localtax1, not localtax2 (method we provide value)
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
@@ -172,9 +172,9 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
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),$result2,'Test2 ES');
|
||||
|
||||
|
||||
// --------------------------------------------------------
|
||||
|
||||
|
||||
// 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1 type 3, 0% localtax2 type 5 (method we provide value)
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
@@ -184,7 +184,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
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),$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';
|
||||
$mysoc->country_id=4;
|
||||
@@ -194,19 +194,19 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
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),$result2,'Test4 ES');
|
||||
|
||||
|
||||
// --------------------------------------------------------
|
||||
|
||||
// 10 * 10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 19% localtax2 type 5 (method we provide value)
|
||||
|
||||
// 10 * 10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 21% localtax2 type 5 (method we provide value)
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=0;
|
||||
$mysoc->localtax2_assuj=1;
|
||||
$result2=calcul_price_total(10, 10, 0, 10, 0, -19, 0, 'HT', 0, 0);
|
||||
$result2=calcul_price_total(10, 10, 0, 10, 0, -1, 0, 'HT', 0, 0);
|
||||
// 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),$result2,'Test5 ES');
|
||||
$this->assertEquals(array(100, 10, 89, 10, 1, 8.9, 100, 10, 89, 0, -21, 0, -2.10, 0, 0, -21),$result2,'Test5 ES');
|
||||
|
||||
// 10 * 10 HT - 0% discount with 10% vat and 1.4% localtax1 type 3, 0% localtax2 type 5 (other method autodetect)
|
||||
// 10 * 10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 21% localtax2 type 5 (other method autodetect)
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=0;
|
||||
@@ -214,19 +214,19 @@ 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, 91, 10, 1, 9.1, 100, 10, 91, 0, -19, 0, -1.90, 0, 0, -19),$result2,'Test6 ES');
|
||||
|
||||
$this->assertEquals(array(100, 10, 89, 10, 1, 8.9, 100, 10, 89, 0, -21, 0, -2.10, 0, 0, -21),$result2,'Test6 ES');
|
||||
|
||||
// --------------------------------------------------------
|
||||
|
||||
// Credit Note: 10 * -10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 19% localtax2 type 5 (method we provide value)
|
||||
|
||||
// Credit Note: 10 * -10 HT - 0% discount with 10% vat and 0% localtax1 type 3, 21% localtax2 type 5 (method we provide value)
|
||||
$mysoc->country_code='ES';
|
||||
$mysoc->country_id=4;
|
||||
$mysoc->localtax1_assuj=0;
|
||||
$mysoc->localtax2_assuj=1;
|
||||
$result2=calcul_price_total(10, -10, 0, 10, 0, 19, 0, 'HT', 0, 0);
|
||||
$result2=calcul_price_total(10, -10, 0, 10, 0, 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, -91, -10, -1, -9.1, -100, -10,- 91, 0, 19, 0, 1.90, 0, 0, 19),$result2,'Test7 ES');
|
||||
$this->assertEquals(array(-100, -10, -89, -10, -1, -8.9, -100, -10, -89, 0, 21, 0, 2.1, 0, 0, 21),$result2,'Test7 ES');
|
||||
|
||||
// Credit Note: 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';
|
||||
@@ -235,13 +235,13 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
$mysoc->localtax2_assuj=1;
|
||||
$result2=calcul_price_total(10, -10, 0, 10, -1, -1, 0, 'HT', 0, 0);
|
||||
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),$result2,'Test8 ES');
|
||||
|
||||
|
||||
$this->assertEquals(array(-100, -10, -89, -10, -1, -8.9, -100, -10, -89, 0, 21, 0, 2.1, 0, 0, 21),$result2,'Test8 ES');
|
||||
|
||||
|
||||
/*
|
||||
* Country Côte d'Ivoire
|
||||
* Country Côte d'Ivoire
|
||||
*/
|
||||
|
||||
|
||||
// 10 * 10 HT - 0% discount with 18% vat, seller using localtax1 type 2, not localtax2 (method we provide value)
|
||||
$mysoc->country_code='CI';
|
||||
$mysoc->country_id=21;
|
||||
@@ -253,7 +253,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
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),$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';
|
||||
$mysoc->country_id=21;
|
||||
@@ -263,7 +263,7 @@ class PricesTest extends PHPUnit_Framework_TestCase
|
||||
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),$result3,'Test10 CI');
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user