mirror of
https://github.com/Dolibarr/dolibarr.git
synced 2026-01-04 08:02:22 +01:00
Fix pb into date management.
Added phpunit to avoid this in future.
This commit is contained in:
@@ -341,4 +341,24 @@ class DateLibTest extends PHPUnit_Framework_TestCase
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* testDolGetFirstDayWeek
|
||||
*
|
||||
* @return int
|
||||
*/
|
||||
public function testDolGetFirstDayWeek()
|
||||
{
|
||||
global $conf;
|
||||
|
||||
$day=3; $month=2; $year=2015;
|
||||
$conf->global->MAIN_START_WEEK = 1; // start on monday
|
||||
$prev = dol_get_first_day_week($day, $month, $year);
|
||||
$this->assertEquals(2, (int) $prev['first_day']); // monday for month 2, year 2014 is the 2
|
||||
|
||||
$day=3; $month=2; $year=2015;
|
||||
$conf->global->MAIN_START_WEEK = 0; // start on sunday
|
||||
$prev = dol_get_first_day_week($day, $month, $year);
|
||||
$this->assertEquals(1, (int) $prev['first_day']); // sunday for month 2, year 2015 is the 1st
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user