Skip to content

Commit

Permalink
Add more log and phpunit
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jul 30, 2019
1 parent 00a4359 commit 0ab16b7
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
4 changes: 2 additions & 2 deletions htdocs/holiday/class/holiday.class.php
Expand Up @@ -1638,7 +1638,7 @@ public function getCPforUser($user_id, $fk_type = 0)
$sql.= " WHERE fk_user = '".$user_id."'";
if ($fk_type > 0) $sql.=" AND fk_type = ".$fk_type;

dol_syslog(get_class($this).'::getCPforUser', LOG_DEBUG);
dol_syslog(get_class($this).'::getCPforUser user_id='.$user_id.' type_id='.$fk_type, LOG_DEBUG);
$result = $this->db->query($sql);
if($result)
{
Expand Down Expand Up @@ -1826,7 +1826,7 @@ public function fetchUsers($stringlist = true, $type = true, $filters = '')
else
{
// List of vacation balance users
$sql = "SELECT cpu.fk_user as userid, cpu.fk_type, cpu.nb_holiday, u.lastname, u.firstname, u.gender, u.photo, u.employee, u.statut, u.fk_user";
$sql = "SELECT cpu.fk_type, cpu.nb_holiday, u.rowid, u.lastname, u.firstname, u.gender, u.photo, u.employee, u.statut, u.fk_user";
$sql.= " FROM ".MAIN_DB_PREFIX."holiday_users as cpu, ".MAIN_DB_PREFIX."user as u";
$sql.= " WHERE cpu.fk_user = u.rowid";
if ($filters) $sql.=$filters;
Expand Down
17 changes: 16 additions & 1 deletion test/phpunit/HolidayTest.php
Expand Up @@ -47,7 +47,7 @@
* @backupStaticAttributes enabled
* @remarks backupGlobals must be disabled to have db,conf,user and lang not erased.
*/
class HolidayTest extends PHPUnit_Framework_TestCase
class HolidayTest extends PHPUnit\Framework\TestCase
{
protected $savconf;
protected $savuser;
Expand Down Expand Up @@ -351,4 +351,19 @@ public function testVerifDateHolidayCP()
$result=$localobjectc->verifDateHolidayCP($user->id, $date_debut, $date_fin, 2); // start afternoon and end morning
$this->assertTrue($result, 'result should be true, there is no overlapping');
}

/**
* testUpdateBalance
*
* @return void
*/
public function testUpdateBalance()
{
$localobjecta=new Holiday($this->savdb);

$localobjecta->updateConfCP('lastUpdate', '20100101120000');

$localobjecta->updateBalance();
}

}

0 comments on commit 0ab16b7

Please sign in to comment.