1<?php 2/** 3 * OrangeHRM is a comprehensive Human Resource Management (HRM) System that captures 4 * all the essential functionalities required for any enterprise. 5 * Copyright (C) 2006 OrangeHRM Inc., http://www.orangehrm.com 6 * 7 * OrangeHRM is free software; you can redistribute it and/or modify it under the terms of 8 * the GNU General Public License as published by the Free Software Foundation; either 9 * version 2 of the License, or (at your option) any later version. 10 * 11 * OrangeHRM is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 12 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 13 * See the GNU General Public License for more details. 14 * 15 * You should have received a copy of the GNU General Public License along with this program; 16 * if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 17 * Boston, MA 02110-1301, USA 18 */ 19 20/** 21 * @group ohrmWidget 22 */ 23class ohrmReportWidgetEmployeeListAutoFillTest extends PHPUnit\Framework\TestCase 24{ 25 /** 26 * @var ohrmReportWidgetEmployeeListAutoFill 27 */ 28 private $ohrmReportWidgetEmployeeListAutoFill = null; 29 30 protected function setUp(): void 31 { 32 $this->ohrmReportWidgetEmployeeListAutoFill = $this->getMockBuilder(ohrmReportWidgetEmployeeListAutoFill::class) 33 ->setMethods(['configure']) 34 ->getMock(); 35 } 36 37 public function testGenerateWhereClausePart() 38 { 39 $returnValue = $this->ohrmReportWidgetEmployeeListAutoFill->generateWhereClausePart( 40 'hs_hr_employee.emp_number', 41 [ 42 'empId' => '1', 43 'empName' => 'Employee Name' 44 ] 45 ); 46 $this->assertEquals("hs_hr_employee.emp_number = '1'", $returnValue); 47 } 48 49 public function testGenerateWhereClausePartWithSql() 50 { 51 $returnValue = $this->ohrmReportWidgetEmployeeListAutoFill->generateWhereClausePart( 52 'hs_hr_employee.emp_number', 53 [ 54 'empId' => '1;DELETE FROM `hs_hr_employee` WHERE `hs_hr_employee`.`emp_number` = "1";', 55 'empName' => 'Employee Name' 56 ] 57 ); 58 $this->assertEquals( 59 'hs_hr_employee.emp_number = \'1;DELETE FROM `hs_hr_employee` WHERE `hs_hr_employee`.`emp_number` = \"1\";\'', 60 $returnValue 61 ); 62 } 63} 64