PageRenderTime 48ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/lib/models/recruitment/JobApplicationTest.php

https://bitbucket.org/wildanm/orangehrm
PHP | 518 lines | 320 code | 72 blank | 126 comment | 4 complexity | 8dd5a760214e18b86b53ce033ef33e3c MD5 | raw file
Possible License(s): CC-BY-SA-3.0, AGPL-3.0, BSD-3-Clause, AGPL-1.0, GPL-2.0, LGPL-2.1, LGPL-3.0
  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. // Call JobApplicationTest::main() if this source file is executed directly.
  21. if (!defined("PHPUnit_MAIN_METHOD")) {
  22. define("PHPUnit_MAIN_METHOD", "JobApplicationTest::main");
  23. }
  24. require_once "PHPUnit/Framework/TestCase.php";
  25. require_once "PHPUnit/Framework/TestSuite.php";
  26. require_once "testConf.php";
  27. require_once ROOT_PATH."/lib/confs/Conf.php";
  28. require_once ROOT_PATH."/lib/confs/sysConf.php";
  29. require_once ROOT_PATH."/lib/models/recruitment/JobApplication.php";
  30. require_once ROOT_PATH."/lib/models/recruitment/JobVacancy.php";
  31. require_once ROOT_PATH."/lib/common/UniqueIDGenerator.php";
  32. require_once ROOT_PATH."/lib/common/LocaleUtil.php";
  33. /**
  34. * Test class for JobApplication
  35. */
  36. class JobApplicationTest extends PHPUnit_Framework_TestCase {
  37. private $jobApplications;
  38. /**
  39. * Runs the test methods of this class.
  40. *
  41. * @access public
  42. * @static
  43. */
  44. public static function main() {
  45. require_once "PHPUnit/TextUI/TestRunner.php";
  46. $suite = new PHPUnit_Framework_TestSuite("JobApplicationTest");
  47. $result = PHPUnit_TextUI_TestRunner::run($suite);
  48. }
  49. /**
  50. * Sets up the fixture, making sure table is empty and creating database
  51. * entries needed during test.
  52. *
  53. * @access protected
  54. */
  55. protected function setUp() {
  56. $conf = new Conf();
  57. $this->connection = mysql_connect($conf->dbhost.":".$conf->dbport, $conf->dbuser, $conf->dbpass);
  58. mysql_select_db($conf->dbname);
  59. $this->_deleteTables();
  60. // Insert job titles
  61. $this->_runQuery("INSERT INTO hs_hr_job_title(jobtit_code, jobtit_name, jobtit_desc, jobtit_comm, sal_grd_code) " .
  62. "VALUES('JOB001', 'Manager', 'Manager job title', 'no comments', null)");
  63. $this->_runQuery("INSERT INTO hs_hr_job_title(jobtit_code, jobtit_name, jobtit_desc, jobtit_comm, sal_grd_code) " .
  64. "VALUES('JOB002', 'Driver', 'Driver job title', 'no comments', null)");
  65. $this->_runQuery("INSERT INTO hs_hr_job_title(jobtit_code, jobtit_name, jobtit_desc, jobtit_comm, sal_grd_code) " .
  66. "VALUES('JOB003', 'Typist', 'Typist job title', 'no comments', null)");
  67. $this->_runQuery("INSERT INTO hs_hr_job_title(jobtit_code, jobtit_name, jobtit_desc, jobtit_comm, sal_grd_code) " .
  68. "VALUES('JOB004', 'Programmer', 'Software Programmer', 'no comments', null)");
  69. // Insert employees (managers)
  70. $this->_runQuery("INSERT INTO hs_hr_employee(emp_number, employee_id, emp_lastname, emp_firstname, emp_middle_name, job_title_code) " .
  71. "VALUES(11, '0011', 'Rajasinghe', 'Saman', 'Marlon', 'JOB001')");
  72. $this->_runQuery("INSERT INTO hs_hr_employee(emp_number, employee_id, emp_lastname, emp_firstname, emp_middle_name, job_title_code) " .
  73. "VALUES(12, '0022', 'Jayasinghe', 'Aruna', 'Shantha', 'JOB001')");
  74. $this->_runQuery("INSERT INTO hs_hr_employee(emp_number, employee_id, emp_lastname, emp_firstname, emp_middle_name, job_title_code) " .
  75. "VALUES(13, '0042', 'Jayaweera', 'Nimal', 'T', 'JOB001')");
  76. $this->_runQuery("INSERT INTO hs_hr_employee(emp_number, employee_id, emp_lastname, emp_firstname, emp_middle_name, job_title_code) " .
  77. "VALUES(14, '0044', 'Karunarathne', 'Jaya', 'S', 'JOB001')");
  78. $this->_runQuery("INSERT INTO hs_hr_employee(emp_number, employee_id, emp_lastname, emp_firstname, emp_middle_name, job_title_code) " .
  79. "VALUES(15, '0054', 'Ranasinghe', 'Kamal', 'Z', 'JOB001')");
  80. // Insert to hs_hr_users table
  81. $this->_runQuery("INSERT INTO `hs_hr_users`(id, user_name, emp_number) VALUES ('USR111','demo', 11)");
  82. // Insert Job Vacancies
  83. $this->_runQuery("INSERT INTO hs_hr_job_vacancy(vacancy_id, jobtit_code, manager_id, active, description) " .
  84. "VALUES(1, 'JOB001', 11, " . JobVacancy::STATUS_ACTIVE . ", 'Job vacancy 1')");
  85. $this->_runQuery("INSERT INTO hs_hr_job_vacancy(vacancy_id, jobtit_code, manager_id, active, description) " .
  86. "VALUES(2, 'JOB002', 11, " . JobVacancy::STATUS_INACTIVE . ", 'Job vacancy 2')");
  87. $this->_runQuery("INSERT INTO hs_hr_job_vacancy(vacancy_id, jobtit_code, manager_id, active, description) " .
  88. "VALUES(3, 'JOB003', 12, " . JobVacancy::STATUS_INACTIVE . ", 'Job vacancy 3')");
  89. // Insert Job Applications
  90. $application = $this->_getJobApplication(1, 1, 'Janaka', 'T', 'Kulathunga', '111 Main Street', 'Apt X2',
  91. 'Colombo', 'Western', '2222', 'Sri Lanka', '01121111121', '077282828282', 'janaka@example.com',
  92. 'aaa bbb', JobApplication::STATUS_SECOND_INTERVIEW_SCHEDULED);
  93. $application->setHiringManagerName('Saman Rajasinghe');
  94. $application->setJobTitleName('Manager');
  95. $this->jobApplications[1] = $application;
  96. $application = $this->_getJobApplication(2, 2, 'Kamal', 'S', 'Manawarathne', '222 Sea Street', 'Suite B2',
  97. 'Kandy', 'Central', '111111', 'England', '33211121', '079982828282', 'kamal@etst.com',
  98. 'asdfasdf', JobApplication::STATUS_FIRST_INTERVIEW_SCHEDULED);
  99. $application->setHiringManagerName('Saman Rajasinghe');
  100. $application->setJobTitleName('Driver');
  101. $this->jobApplications[2] = $application;
  102. $application = $this->_getJobApplication(3, 3, 'Ruwan', 'S', 'Nawarathne', '393 Hill Street', '#2',
  103. 'Nuwaraeliya', 'Central', '2333', 'Sri Lanka', '05121111121', '072282828282', 'rywab@sfmple.com',
  104. 'aaa sdf bbb', JobApplication::STATUS_SUBMITTED);
  105. $application->setHiringManagerName('Aruna Jayasinghe');
  106. $application->setJobTitleName('Typist');
  107. $this->jobApplications[3] = $application;
  108. $this->_createJobApplications($this->jobApplications);
  109. // Create job application events
  110. $createdTime = date(LocaleUtil::STANDARD_TIMESTAMP_FORMAT, strtotime("-1 hours"));
  111. $eventTime = date(LocaleUtil::STANDARD_TIMESTAMP_FORMAT, strtotime("+5 days"));
  112. // Events for first job application
  113. $this->_createEvent(1, 1, $createdTime, 'USR111', 13, $eventTime,
  114. JobApplicationEvent::EVENT_SCHEDULE_FIRST_INTERVIEW, JobApplicationEvent::STATUS_INTERVIEW_FINISHED,
  115. "1st Interview notes, here");
  116. $createdTime = date(LocaleUtil::STANDARD_TIMESTAMP_FORMAT, strtotime("-0.6 hours"));
  117. $eventTime = date(LocaleUtil::STANDARD_TIMESTAMP_FORMAT, strtotime("+6 days"));
  118. $this->_createEvent(2, 1, $createdTime, 'USR111', 14, $eventTime,
  119. JobApplicationEvent::EVENT_SCHEDULE_SECOND_INTERVIEW, JobApplicationEvent::STATUS_INTERVIEW_SCHEDULED,
  120. "2nd Interview notes, here");
  121. // Events for second job application
  122. $this->_createEvent(3, 2, $createdTime, 'USR111', 14, $eventTime,
  123. JobApplicationEvent::EVENT_SCHEDULE_FIRST_INTERVIEW, JobApplicationEvent::STATUS_INTERVIEW_SCHEDULED,
  124. "3rd Interview notes, here");
  125. UniqueIDGenerator::getInstance()->resetIDs();
  126. }
  127. /**
  128. * Tears down the fixture, removed database entries created during test.
  129. *
  130. * @access protected
  131. */
  132. protected function tearDown() {
  133. $this->_deleteTables();
  134. UniqueIDGenerator::getInstance()->resetIDs();
  135. }
  136. private function _deleteTables() {
  137. $this->_runQuery("DELETE FROM `hs_hr_users` WHERE id = 'USR111'");
  138. $this->_runQuery("TRUNCATE TABLE `hs_hr_job_application_events`");
  139. $this->_runQuery("TRUNCATE TABLE `hs_hr_job_application`");
  140. $this->_runQuery("TRUNCATE TABLE `hs_hr_job_vacancy`");
  141. $this->_runQuery("TRUNCATE TABLE `hs_hr_job_title`");
  142. $this->_runQuery("TRUNCATE TABLE `hs_hr_employee`");
  143. }
  144. /**
  145. * Test the save function
  146. */
  147. public function testSave() {
  148. // new
  149. $before = $this->_getNumRows();
  150. $application = $this->_getJobApplication(null, 2, 'Janaka', 'T', 'Kulathunga', '111 Main Street', 'Apt X2',
  151. 'Colombo', 'Western', '2222', 'Sri Lanka', '01121111121', '077282828282', 'janaka@example.com',
  152. 'aaa bbb');
  153. $id = $application->save();
  154. $this->assertEquals(($before + 1), $this->_getNumRows());
  155. $this->_checkExistsInDb($application);
  156. // update
  157. $before = $this->_getNumRows();
  158. $application = $this->_getJobApplication($id, 3, 'Ruwan', 'K', 'Ranathunga', '222 Main Street', 'Suite B1',
  159. 'Kandy', 'Central', '1111', 'England', '0331111121', '066282828282', 'ruwan@example.com',
  160. 'sdfsadfasdf fdsfdsndsfb');
  161. $newId = $application->save();
  162. $this->assertEquals($id, $newId);
  163. $this->assertEquals($before, $this->_getNumRows());
  164. $this->_checkExistsInDb($application);
  165. // without job_vacancy id
  166. $application = $this->_getJobApplication(3, null, 'Ruwan', 'K', 'Ranathunga', '222 Main Street', 'Suite B1',
  167. 'Kandy', 'Central', '1111', 'England', '0331111121', '066282828282', 'ruwan@example.com',
  168. 'sdfsadfasdf fdsfdsndsfb');
  169. try {
  170. $application->save();
  171. $this->fail("Exception expected");
  172. } catch (JobApplicationException $e) {
  173. $this->assertEquals(JobApplicationException::MISSING_PARAMETERS, $e->getCode());
  174. }
  175. // Invalid job vacancy id
  176. $application = $this->_getJobApplication(5, 'sf', 'Ruwan', 'K', 'Ranathunga', '222 Main Street', 'Suite B1',
  177. 'Kandy', 'Central', '1111', 'England', '0331111121', '066282828282', 'ruwan@example.com',
  178. 'sdfsadfasdf fdsfdsndsfb');
  179. try {
  180. $application->save();
  181. $this->fail("Exception expected");
  182. } catch (JobApplicationException $e) {
  183. $this->assertEquals(JobApplicationException::INVALID_PARAMETER, $e->getCode());
  184. }
  185. // Invalid ID
  186. $application = $this->_getJobApplication('22k1', 2, 'Ruwan', 'K', 'Ranathunga', '222 Main Street', 'Suite B1',
  187. 'Kandy', 'Central', '1111', 'England', '0331111121', '066282828282', 'ruwan@example.com',
  188. 'sdfsadfasdf fdsfdsndsfb');
  189. try {
  190. $application->save();
  191. $this->fail("Exception expected");
  192. } catch (JobApplicationException $e) {
  193. $this->assertEquals(JobApplicationException::INVALID_PARAMETER, $e->getCode());
  194. }
  195. // without firstname, last name
  196. $application = $this->_getJobApplication(7, 2, null, 'K', null, '222 Main Street', 'Suite B1',
  197. 'Kandy', 'Central', '1111', 'England', '0331111121', '066282828282', 'ruwan@example.com',
  198. 'sdfsadfasdf fdsfdsndsfb');
  199. try {
  200. $application->save();
  201. $this->fail("Exception expected");
  202. } catch (JobApplicationException $e) {
  203. $this->assertEquals(JobApplicationException::MISSING_PARAMETERS, $e->getCode());
  204. }
  205. // without email
  206. $application = $this->_getJobApplication(7, 2, 'Kamal', 'K', 'Thilakarathne', '222 Main Street', 'Suite B1',
  207. 'Kandy', 'Central', '1111', 'England', '0331111121', '066282828282', null,
  208. 'sdfsadfasdf fdsfdsndsfb');
  209. try {
  210. $application->save();
  211. $this->fail("Exception expected");
  212. } catch (JobApplicationException $e) {
  213. $this->assertEquals(JobApplicationException::MISSING_PARAMETERS, $e->getCode());
  214. }
  215. }
  216. /**
  217. * Test for function getList()
  218. */
  219. public function testGetList() {
  220. // get list
  221. $list = JobApplication::getList();
  222. $this->_compareApplications($this->jobApplications, $list);
  223. // get list for hiring manager with 2 related applications
  224. $list = JobApplication::getList(11);
  225. $expected = array(1=>$this->jobApplications[1], 2=>$this->jobApplications[2]);
  226. $this->_compareApplications($expected, $list);
  227. // get list for hiring manager with 1 related applications
  228. $list = JobApplication::getList(12);
  229. $expected = array(3=>$this->jobApplications[3]);
  230. $this->_compareApplications($expected, $list);
  231. // get list for hiring manager without any related applications
  232. $list = JobApplication::getList(15);
  233. $expected = array();
  234. $this->_compareApplications($expected, $list);
  235. // Get list for manager scheduled to interview applicant
  236. $list = JobApplication::getList(13);
  237. $expected = array(1=>$this->jobApplications[1]);
  238. $this->_compareApplications($expected, $list);
  239. // Get list for manager scheduled to interview applicant
  240. $list = JobApplication::getList(14);
  241. $expected = array(1=>$this->jobApplications[1], 2=>$this->jobApplications[2]);
  242. $this->_compareApplications($expected, $list);
  243. }
  244. /**
  245. * Test the getEventOfType() function
  246. */
  247. public function testGetEventOfType() {
  248. $jobApplication = JobApplication::GetJobApplication(1);
  249. $event = $jobApplication->getEventOfType(JobApplicationEvent::EVENT_SCHEDULE_FIRST_INTERVIEW);
  250. $this->assertNotNull($event);
  251. $this->assertEquals(1, $event->getId());
  252. $this->assertEquals("1st Interview notes, here", $event->getNotes());
  253. $jobApplication = JobApplication::GetJobApplication(1);
  254. $event = $jobApplication->getEventOfType(JobApplicationEvent::EVENT_SCHEDULE_SECOND_INTERVIEW);
  255. $this->assertNotNull($event);
  256. $this->assertEquals(2, $event->getId());
  257. $this->assertEquals("2nd Interview notes, here", $event->getNotes());
  258. // Unavailable event type
  259. $jobApplication = JobApplication::GetJobApplication(1);
  260. $event = $jobApplication->getEventOfType(JobApplicationEvent::EVENT_REJECT);
  261. $this->assertNull($event);
  262. $jobApplication = JobApplication::GetJobApplication(2);
  263. $event = $jobApplication->getEventOfType(JobApplicationEvent::EVENT_SCHEDULE_FIRST_INTERVIEW);
  264. $this->assertNotNull($event);
  265. $this->assertEquals(3, $event->getId());
  266. $this->assertEquals("3rd Interview notes, here", $event->getNotes());
  267. $jobApplication = JobApplication::GetJobApplication(3);
  268. $event = $jobApplication->getEventOfType(JobApplicationEvent::EVENT_SCHEDULE_SECOND_INTERVIEW);
  269. $this->assertNull($event);
  270. }
  271. /**
  272. * Test the getLatestEvent() function
  273. */
  274. public function testGetLatestEvent() {
  275. $jobApplication = JobApplication::GetJobApplication(1);
  276. $event = $jobApplication->getLatestEvent();
  277. $this->assertNotNull($event);
  278. $this->assertEquals(2, $event->getId());
  279. $this->assertEquals("2nd Interview notes, here", $event->getNotes());
  280. $jobApplication = JobApplication::GetJobApplication(2);
  281. $event = $jobApplication->getLatestEvent();
  282. $this->assertNotNull($event);
  283. $this->assertEquals(3, $event->getId());
  284. $this->assertEquals("3rd Interview notes, here", $event->getNotes());
  285. $jobApplication = JobApplication::GetJobApplication(3);
  286. $event = $jobApplication->getLatestEvent();
  287. $this->assertNull($event);
  288. }
  289. /**
  290. * Check's that the passed appliation exists in the database
  291. *
  292. * @param JobApplication Job Application to check
  293. */
  294. private function _checkExistsInDb($application) {
  295. $id = $application->getId();
  296. $vacancyId = $application->getVacancyId();
  297. $firstName = $application->getFirstName();
  298. $middleName = $application->getMiddleName();
  299. $lastName = $application->getLastName();
  300. $street1 = $application->getStreet1();
  301. $street2 = $application->getStreet2();
  302. $city = $application->getCity();
  303. $province = $application->getProvince();
  304. $zip = $application->getZip();
  305. $country = $application->getCountry();
  306. $mobile = $application->getMobile();
  307. $phone = $application->getPhone();
  308. $email = $application->getEmail();
  309. $qualifications = $application->getQualifications();
  310. $this->assertEquals(1, $this->_getNumRows("application_id = {$id} AND vacancy_id = {$vacancyId} AND " .
  311. "firstname = '{$firstName}' AND middlename = '{$middleName}' AND lastname = '{$lastName}' AND " .
  312. "street1 = '{$street1}' AND street2 = '{$street2}' AND city = '{$city}' AND " .
  313. "country_code = '{$country}' AND province = '{$province}' AND zip = '{$zip}' AND " .
  314. "phone = '{$phone}' AND mobile= '{$mobile}' AND email = '{$email}' AND " .
  315. "qualifications = '{$qualifications}'"));
  316. }
  317. /**
  318. * Returns the number of rows in the hs_hr_job_application table
  319. *
  320. * @param string $where where clause
  321. * @return int number of rows
  322. */
  323. private function _getNumRows($where = null) {
  324. $sql = "SELECT COUNT(*) FROM hs_hr_job_application";
  325. if (!empty($where)) {
  326. $sql .= " WHERE " . $where;
  327. }
  328. $result = mysql_query($sql);
  329. $row = mysql_fetch_array($result, MYSQL_NUM);
  330. $count = $row[0];
  331. return $count;
  332. }
  333. /**
  334. * Compares two array of JobApplication objects verifing they contain the same
  335. * objects, without considering the order
  336. *
  337. * Objects in first array should be indexed by their id's
  338. *
  339. * @param array $expected Expected
  340. * @param array $result Result
  341. */
  342. private function _compareApplications($expected, $result) {
  343. $this->assertEquals(count($expected), count($result));
  344. foreach ($result as $application) {
  345. $this->assertTrue($application instanceof JobApplication, "Should return JobApplication objects");
  346. $id = $application->getId();
  347. $this->assertEquals($expected[$id], $application);
  348. }
  349. }
  350. /**
  351. * Create a JobApplication object with the passed parameters
  352. */
  353. private function _getJobApplication($id, $vacancyId, $firstName, $middleName, $lastName, $street1, $street2,
  354. $city, $province, $zip, $country, $mobile, $phone, $email, $qualifications, $status = JobApplication::STATUS_SUBMITTED) {
  355. $application = new JobApplication($id);
  356. $application->setVacancyId($vacancyId);
  357. $application->setFirstName($firstName);
  358. $application->setMiddleName($middleName);
  359. $application->setLastName($lastName);
  360. $application->setStreet1($street1);
  361. $application->setStreet2($street2);
  362. $application->setCity($city);
  363. $application->setProvince($province);
  364. $application->setZip($zip);
  365. $application->setCountry($country);
  366. $application->setMobile($mobile);
  367. $application->setPhone($phone);
  368. $application->setEmail($email);
  369. $application->setQualifications($qualifications);
  370. $application->setStatus($status);
  371. $application->setAppliedDateTime(date(LocaleUtil::STANDARD_TIMESTAMP_FORMAT));
  372. return $application;
  373. }
  374. /**
  375. * Compares two array of JobApplication objects verifing they contain the same
  376. * objects and considering the order
  377. *
  378. *
  379. * @param array $expected Expected
  380. * @param array $result Result
  381. */
  382. private function _compareApplicationsWithOrder($expected, $result) {
  383. $this->assertEquals(count($expected), count($result));
  384. $i = 0;
  385. foreach ($expected as $application) {
  386. $this->assertEquals($application, $result[$i]);
  387. $i++;
  388. }
  389. }
  390. /**
  391. * Saves the given JobApplication objects in the database
  392. *
  393. * @param array $applications Array of JobApplication objects to save.
  394. */
  395. private function _createJobApplications($applications) {
  396. foreach ($applications as $application) {
  397. $sql = sprintf("INSERT INTO hs_hr_job_application(application_id, vacancy_id, firstname, middlename, ".
  398. "lastname, street1, street2, city, country_code, province, zip, " .
  399. "phone, mobile, email, qualifications, status, applied_datetime) " .
  400. "VALUES(%d, %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, '%s')",
  401. $application->getId(), $application->getVacancyId(), $application->getFirstName(),
  402. $application->getMiddleName(), $application->getLastName(), $application->getStreet1(),
  403. $application->getStreet2(), $application->getCity(), $application->getCountry(),
  404. $application->getProvince(), $application->getZip(), $application->getPhone(),
  405. $application->getMobile(), $application->getEmail(),
  406. $application->getQualifications(), $application->getStatus(),
  407. $application->getAppliedDateTime());
  408. $this->assertTrue(mysql_query($sql), mysql_error());
  409. }
  410. UniqueIDGenerator::getInstance()->initTable();
  411. }
  412. /**
  413. * Create job application event with the passed parameters
  414. *
  415. * @param int $id
  416. * @param int $applicationId
  417. * @param String $createdTime
  418. * @param String $createdBy
  419. * @param int $ownerId
  420. * @param String $eventTime
  421. * @param int $eventType
  422. * @param int $eventStatus
  423. * @param String $notes
  424. */
  425. private function _createEvent($id, $applicationId, $createdTime, $createdBy, $ownerId, $eventTime,
  426. $eventType, $eventStatus, $notes) {
  427. $sql = sprintf("INSERT INTO `hs_hr_job_application_events`(`id`,`application_id`,`created_time`," .
  428. "`created_by`, `owner`, `event_time`, `event_type`, `status`, `notes`) " .
  429. "VALUES (%d, %d, '%s', '%s', %d, '%s', %d, %d, '%s')",
  430. $id, $applicationId, $createdTime, $createdBy, $ownerId, $eventTime,
  431. $eventType, $eventStatus, $notes);
  432. $this->assertTrue(mysql_query($sql), mysql_error());
  433. UniqueIDGenerator::getInstance()->initTable();
  434. }
  435. /**
  436. * Run given sql query, checking the return value
  437. */
  438. private function _runQuery($sql) {
  439. $this->assertTrue(mysql_query($sql), mysql_error());
  440. }
  441. }
  442. // Call JobApplicationTest::main() if this source file is executed directly.
  443. if (PHPUnit_MAIN_METHOD == "JobApplicationTest::main") {
  444. JobApplicationTest::main();
  445. }
  446. ?>