forked from Wavyzz/dolibarr
Fix: Use correct vat rate into text cases.
Qual: Next step cleaning date functions. Qual: Complete phpunit test case for dol_mktime to check dayling saving time is correctly managed.
This commit is contained in:
@@ -367,6 +367,8 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
||||
*/
|
||||
public function testDolMkTime()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$result=dol_mktime(25,0,0,1,1,1970,1,1); // Error (25 hours)
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals('',$result);
|
||||
@@ -390,7 +392,19 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
||||
$result=dol_mktime(2,0,0,1,1,1970,0); // 1970-01-01 02:00:00 = 7200 in local area Europe/Paris = 3600 GMT
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$tz=getServerTimeZoneInt('winter'); // +1 in Europe/Paris at this time (this time is winter)
|
||||
$this->assertEquals(7200-($tz*3600),$result); // Should be 7200 if we are at greenwich winter
|
||||
$this->assertEquals(7200-($tz*3600),$result); // 7200 if we are at greenwich winter, 7200-($tz*3600) at local winter
|
||||
|
||||
// Check that tz for paris in winter is used
|
||||
$conf->global->MAIN_SERVER_TZ='Europe/Paris';
|
||||
$result=dol_mktime(2,0,0,1,1,1970,'server'); // 1970-01-01 02:00:00 = 7200 in local area Europe/Paris = 3600 GMT
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(3600,$result); // 7200 if we are at greenwich winter, 3600 at Europe/Paris
|
||||
|
||||
// Check that daylight saving time is used
|
||||
$conf->global->MAIN_SERVER_TZ='Europe/Paris';
|
||||
$result=dol_mktime(2,0,0,6,1,2014,0); // 2014-06-01 02:00:00 = 1401588000-3600(location)-3600(daylight) in local area Europe/Paris = 1401588000 GMT
|
||||
print __METHOD__." result=".$result."\n";
|
||||
$this->assertEquals(1401588000-3600-3600,$result); // 1401588000 are at greenwich summer, 1401588000-3600(location)-3600(daylight) at Europe/Paris summer
|
||||
}
|
||||
|
||||
|
||||
@@ -574,11 +588,11 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
// Test RULE 2 (FR-FR)
|
||||
$vat=get_default_tva($companyfr,$companyfr,0);
|
||||
$this->assertEquals(19.6,$vat);
|
||||
$this->assertEquals(20,$vat);
|
||||
|
||||
// Test RULE 2 (FR-MC)
|
||||
$vat=get_default_tva($companyfr,$companymc,0);
|
||||
$this->assertEquals(19.6,$vat);
|
||||
$this->assertEquals(20,$vat);
|
||||
|
||||
// Test RULE 3 (FR-IT)
|
||||
$vat=get_default_tva($companyfr,$companyit,0);
|
||||
@@ -586,7 +600,7 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
||||
|
||||
// Test RULE 4 (FR-IT)
|
||||
$vat=get_default_tva($companyfr,$notcompanyit,0);
|
||||
$this->assertEquals(19.6,$vat);
|
||||
$this->assertEquals(20,$vat);
|
||||
|
||||
// Test RULE 5 (FR-US)
|
||||
$vat=get_default_tva($companyfr,$companyus,0);
|
||||
|
||||
Reference in New Issue
Block a user