mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2025-12-06 01:28:19 +01:00
Fix pb into date management.
Added phpunit to avoid this in future.
This commit is contained in:
@@ -888,4 +888,32 @@ class FunctionsLibTest extends PHPUnit_Framework_TestCase
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* testDolGetDate
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public function testDolGetDate()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$conf->global->MAIN_START_WEEK = 0;
|
||||
|
||||
$tmp=dol_getdate(1); // 1/1/1970 and 1 second = thirday
|
||||
$this->assertEquals(4, $tmp['wday']);
|
||||
|
||||
$tmp=dol_getdate(24*60*60+1); // 2/1/1970 and 1 second = friday
|
||||
$this->assertEquals(5, $tmp['wday']);
|
||||
|
||||
$conf->global->MAIN_START_WEEK = 1;
|
||||
|
||||
$tmp=dol_getdate(1); // 1/1/1970 and 1 second = thirday
|
||||
$this->assertEquals(4, $tmp['wday']);
|
||||
|
||||
$tmp=dol_getdate(24*60*60+1); // 2/1/1970 and 1 second = friday
|
||||
$this->assertEquals(5, $tmp['wday']);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user