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 ohrmWidgetEmployeeListAutoFillTest extends PHPUnit\Framework\TestCase 24{ 25 /** 26 * @var ohrmWidgetEmployeeListAutoFill 27 */ 28 private $ohrmWidgetEmployeeListAutoFill = null; 29 30 protected function setUp(): void 31 { 32 $this->ohrmWidgetEmployeeListAutoFill = $this->getMockBuilder(ohrmWidgetEmployeeListAutoFill::class) 33 ->setMethods(['configure']) 34 ->getMock(); 35 } 36 37 public function testGenerateWhereClausePartAsValueAsString() 38 { 39 $returnValue = $this->ohrmWidgetEmployeeListAutoFill->generateWhereClausePart('hs_hr_employee.emp_number', '1'); 40 $this->assertEquals("hs_hr_employee.emp_number = '1'",$returnValue); 41 } 42 43 public function testGenerateWhereClausePartAsValueAsInteger() 44 { 45 $returnValue = $this->ohrmWidgetEmployeeListAutoFill->generateWhereClausePart('hs_hr_employee.emp_number', 1); 46 $this->assertEquals("hs_hr_employee.emp_number = '1'",$returnValue); 47 } 48 49 public function testGenerateWhereClausePartAsValueAsSpecialCharacter() 50 { 51 $returnValue = $this->ohrmWidgetEmployeeListAutoFill->generateWhereClausePart('hs_hr_employee.emp_number', '`'); 52 $this->assertEquals("hs_hr_employee.emp_number = '`'",$returnValue); 53 } 54 55 public function testGenerateWhereClausePartWithSql() 56 { 57 $returnValue = $this->ohrmWidgetEmployeeListAutoFill->generateWhereClausePart('hs_hr_employee.emp_number', '1;DELETE FROM `hs_hr_employee` WHERE `hs_hr_employee`.`emp_number` = 1;'); 58 $this->assertEquals("hs_hr_employee.emp_number = '1;DELETE FROM `hs_hr_employee` WHERE `hs_hr_employee`.`emp_number` = 1;'",$returnValue); 59 } 60}