orangehrm /lib/models/benefits/HspTest.php

Language PHP Lines 318
MD5 Hash 07a86497ba3d5cf33102916ec92a7051 Estimated Cost $4,542 (why?)
Repository https://bitbucket.org/wildanm/orangehrm View Raw File View Project SPDX
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
<?php
// Call HspTest::main() if this source file is executed directly.
if (!defined('PHPUnit_MAIN_METHOD')) {
    define('PHPUnit_MAIN_METHOD', 'HspTest::main');
}

require_once 'PHPUnit/Framework.php';

require_once "testConf.php";
require_once ROOT_PATH."/lib/confs/Conf.php";

require_once 'Hsp.php';

/**
 * Test class for Hsp.
 * Generated by PHPUnit on 2008-02-19 at 11:29:52.
 */
class HspTest extends PHPUnit_Framework_TestCase {
	private $paymentRequestFields;
	private $employeeFields;

    /**
     * Runs the test methods of this class.
     *
     * @access public
     * @static
     */
    public static function main() {
        require_once 'PHPUnit/TextUI/TestRunner.php';

        $suite  = new PHPUnit_Framework_TestSuite('HspTest');
        $result = PHPUnit_TextUI_TestRunner::run($suite);
    }

    /**
     * Sets up the fixture, for example, opens a network connection.
     * This method is called before a test is executed.
     *
     * @access protected
     */
    protected function setUp() {
    	$this->paymentRequestFields = "`id`, `hsp_id`, `employee_id`, `date_incurred`, `provider_name`, `person_incurring_expense`, " .
								"`expense_description`, `expense_amount`, `payment_made_to`, `third_party_account_number`, " .
								"`mail_address`, `comments`, `date_paid`, `check_number`,	`status`";
		$this->employeeFields = "`emp_number`, `employee_id`, `emp_lastname`, `emp_firstname`, `emp_middle_name`, `emp_nick_name`, " .
								"`emp_smoker`, `ethnic_race_code`, `emp_birthday`, `nation_code`, `emp_gender`, `emp_marital_status`, " .
								"`emp_ssn_num`, `emp_sin_num`, `emp_other_id`, `emp_dri_lice_num`, `emp_dri_lice_exp_date`, `emp_military_service`, " .
								"`emp_status`, `job_title_code`, `eeo_cat_code`, `work_station`, `emp_street1`, `emp_street2`, " .
								"`city_code`, `coun_code`, `provin_code`, `emp_zipcode`, `emp_hm_telephone`, `emp_mobile`, " .
								"`emp_work_telephone`, `emp_work_email`, `sal_grd_code`, `joined_date`, `emp_oth_email`";

    	$conf = new Conf();
    	$this->connection = mysql_connect($conf->dbhost.":".$conf->dbport, $conf->dbuser, $conf->dbpass);
        mysql_select_db($conf->dbname);

    }

    /**
     * Tears down the fixture, for example, closes a network connection.
     * This method is called after a test is executed.
     *
     * @access protected
     */
    protected function tearDown() {
    	$this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_hsp_summary`"));
    	$this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_employee`"));
    	$this->assertTrue(mysql_query("UPDATE `hs_hr_config` SET `value` = '0' WHERE `key` = 'hsp_current_plan'"));
    }

    public function testUpdateAccrued() {

		$this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_pay_period`"));
		$this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_hsp_summary`"));

		// Here 'check dates' don't mach with pay periods. They have been added to get three past check dates from current day.
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_pay_period VALUES(1, '".date('Y')."-01-01', '".date('Y')."-01-31', '".date('Y')."-01-31', '".date('Y-m-d', time()-3600*24*3)."', '".date('Y')."-01-20')"));
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_pay_period VALUES(2, '".date('Y')."-02-01', '".date('Y')."-02-29', '".date('Y')."-02-29', '".date('Y-m-d', time()-3600*24*2)."', '".date('Y')."-02-20')"));
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_pay_period VALUES(3, '".date('Y')."-03-01', '".date('Y')."-03-31', '".date('Y')."-03-31', '".date('Y-m-d', time()-3600*24*1)."', '".date('Y')."-03-20')"));

		// Summary Insert
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_hsp_summary VALUES(1, 1, 1, '".date('Y')."', 1, 1500, 50, 50, 0, 0)"), mysql_error());
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_hsp_summary VALUES(2, 2, 1, '".date('Y')."', 1, 2500, 75, 75, 0, 0)"), mysql_error());

		$this->assertTrue(mysql_query("UPDATE `hs_hr_config` SET `value` = '".(date('Y')-1)."-12-31' WHERE `key` = 'hsp_accrued_last_updated'"));
		$this->assertTrue(mysql_query("UPDATE `hs_hr_config` SET `value` = '1' WHERE `key` = 'hsp_current_plan'"));

		$result = mysql_query("SELECT COUNT(*) FROM `hs_hr_pay_period` WHERE `check_date` < '".date('Y-m-d')."'");
		$resultArray = mysql_fetch_array($result);

		$expectedAccrued1 = 100*$resultArray[0]; // 100 comes from Summary Insert (50+50)
		$expectedAccrued2 = 150*$resultArray[0];

		Hsp::updateAccrued(date('Y')); // total_accrued is calculated by function and should be equal to $expectedAccrued

		$result = mysql_query("SELECT `total_accrued` FROM `hs_hr_hsp_summary` WHERE `summary_id` = 1");
		$resultArray = mysql_fetch_array($result);

		$this->assertEquals($resultArray[0], $expectedAccrued1);

		$result = mysql_query("SELECT `total_accrued` FROM `hs_hr_hsp_summary` WHERE `summary_id` = 2");
		$resultArray = mysql_fetch_array($result);

		$this->assertEquals($resultArray[0], $expectedAccrued2);

   }

    public function testUpdateAccruedHalted() {

		$this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_pay_period`"));
		$this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_hsp_summary`"));

		// Here 'check dates' don't mach with pay periods. They have been added to get three past check dates from current day.
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_pay_period VALUES(1, '".date('Y')."-01-01', '".date('Y')."-01-31', '".date('Y')."-01-31', '".date('Y-m-d', time()-3600*24*3)."', '".date('Y')."-01-20')"));
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_pay_period VALUES(2, '".date('Y')."-02-01', '".date('Y')."-02-29', '".date('Y')."-02-29', '".date('Y-m-d', time()-3600*24*2)."', '".date('Y')."-02-20')"));
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_pay_period VALUES(3, '".date('Y')."-03-01', '".date('Y')."-03-31', '".date('Y')."-03-31', '".date('Y-m-d', time()-3600*24*1)."', '".date('Y')."-03-20')"));

		// Summary Insert
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_hsp_summary VALUES(1, 1, 1, '".date('Y')."', 0, 1500, 50, 50, 823, 0)"), mysql_error());
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_hsp_summary VALUES(2, 2, 1, '".date('Y')."', 0, 2500, 75, 75, 0, 0)"), mysql_error());

		$this->assertTrue(mysql_query("UPDATE `hs_hr_config` SET `value` = '".(date('Y')-1)."-12-31' WHERE `key` = 'hsp_accrued_last_updated'"));
		$this->assertTrue(mysql_query("UPDATE `hs_hr_config` SET `value` = '1' WHERE `key` = 'hsp_current_plan'"));

		$result = mysql_query("SELECT COUNT(*) FROM `hs_hr_pay_period` WHERE `check_date` < '".date('Y-m-d')."'");
		$resultArray = mysql_fetch_array($result);

		// Since `hsp_plan_status` is 0 no accrued should happen
		$expectedAccrued1 = 823;
		$expectedAccrued2 = 0;

		Hsp::updateAccrued(date('Y')); // total_accrued is calculated by function and should be equal to $expectedAccrued

		$result = mysql_query("SELECT `total_accrued` FROM `hs_hr_hsp_summary` WHERE `summary_id` = 1");
		$resultArray = mysql_fetch_array($result);

		$this->assertEquals($expectedAccrued1, $resultArray[0]);

		$result = mysql_query("SELECT `total_accrued` FROM `hs_hr_hsp_summary` WHERE `summary_id` = 2");
		$resultArray = mysql_fetch_array($result);

		$this->assertEquals($expectedAccrued2, $resultArray[0]);

   }

    public function testUpdateAccruedForTwoPlans() {

		$this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_pay_period`"));
		$this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_hsp_summary`"));

		// Here 'check dates' don't mach with pay periods. They have been added to get three past check dates from current day.
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_pay_period VALUES(1, '".date('Y')."-01-01', '".date('Y')."-01-31', '".date('Y')."-01-31', '".date('Y-m-d', time()-3600*24*3)."', '".date('Y')."-01-20')"));
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_pay_period VALUES(2, '".date('Y')."-02-01', '".date('Y')."-02-29', '".date('Y')."-02-29', '".date('Y-m-d', time()-3600*24*2)."', '".date('Y')."-02-20')"));
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_pay_period VALUES(3, '".date('Y')."-03-01', '".date('Y')."-03-31', '".date('Y')."-03-31', '".date('Y-m-d', time()-3600*24*1)."', '".date('Y')."-03-20')"));

		// Summary Insert
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_hsp_summary VALUES(1, 1, 1, '".date('Y')."', 1, 1500, 50, 50, 0, 0)"), mysql_error());
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_hsp_summary VALUES(2, 1, 3, '".date('Y')."', 1, 2500, 75, 75, 0, 0)"), mysql_error());

		$this->assertTrue(mysql_query("UPDATE `hs_hr_config` SET `value` = '".(date('Y')-1)."-12-31' WHERE `key` = 'hsp_accrued_last_updated'"));

		$result = mysql_query("SELECT COUNT(*) FROM `hs_hr_pay_period` WHERE `check_date` < '".date('Y-m-d')."'");
		$resultArray = mysql_fetch_array($result);

		$expectedAccrued1 = 100*$resultArray[0]; // 100 comes from Summary Insert (50+50)
		$expectedAccrued2 = 150*$resultArray[0];

		$this->assertTrue(mysql_query("UPDATE `hs_hr_config` SET `value` = '4' WHERE `key` = 'hsp_current_plan'"));

		Hsp::updateAccrued(date('Y')); // total_accrued is calculated by function and should be equal to $expectedAccrued

		$result = mysql_query("SELECT `total_accrued` FROM `hs_hr_hsp_summary` WHERE `summary_id` = 1");
		$resultArray = mysql_fetch_array($result);

		$this->assertEquals($expectedAccrued1, $resultArray[0]);

		$result = mysql_query("SELECT `total_accrued` FROM `hs_hr_hsp_summary` WHERE `summary_id` = 2");
		$resultArray = mysql_fetch_array($result);

		$this->assertEquals($expectedAccrued2, $resultArray[0]);

    }

    public function testUpdateUsed() {

		$this->assertTrue(mysql_query("TRUNCATE `hs_hr_employee`;", $this->connection), mysql_error());
        $this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_hsp_payment_request`"), mysql_error());
		$this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_hsp_summary`"), mysql_error());

		$this->assertTrue(mysql_query("INSERT INTO `hs_hr_employee` ($this->employeeFields) VALUES (1, '001', 'Arnold', 'Subasinghe', '', 'Arnold', 0, NULL, NULL, NULL, NULL, NULL, '', '', '', '', NULL, '', NULL, NULL, NULL, NULL, '', '', '', 'AF', '', '', '', '', '', '', NULL, NULL, '')"), mysql_error());
		$this->assertTrue(mysql_query("INSERT INTO `hs_hr_employee` ($this->employeeFields) VALUES (2, '002', 'Kalum', 'Kumara', '', 'Kal', 0, NULL, NULL, NULL, NULL, NULL, '', '', '', '', NULL, '', NULL, NULL, NULL, NULL, '', '', '', 'AF', '', '', '', '', '', '', NULL, NULL, '')"), mysql_error());

		// For employee1
		$this->assertTrue(mysql_query("INSERT INTO `hs_hr_hsp_payment_request` ($this->paymentRequestFields) " .
	    							  "VALUES (1, 1, 1, '".date('Y')."-02-01', 'Test provider', 'Tester', 'Just testing', '150', 'TestX', '12345GD', " .
	    							  "'1231, Test Grove, Test City', 'Test', '".date('Y')."-02-02',  '123552-55821-ff25', 1)"), mysql_error());

	    $this->assertTrue(mysql_query("INSERT INTO `hs_hr_hsp_payment_request` ($this->paymentRequestFields) " .
	    							  "VALUES (2, 1, 1, '".date('Y')."-02-10', 'Test provider', 'Tester', 'Just testing', '100', 'TestX', '12345GD', " .
	    							  "'1231, Test Grove, Test City', 'Test', '".date('Y')."-02-11',  '123552-55821-ff25', 1)"), mysql_error());

		$this->assertTrue(mysql_query("INSERT INTO `hs_hr_hsp_payment_request` ($this->paymentRequestFields) " .
	    							  "VALUES (3, 1, 1, '".date('Y')."-02-20', 'Test provider', 'Tester', 'Just testing', '127', 'TestX', '12345GD', " .
	    							  "'1231, Test Grove, Test City', 'Test', '".date('Y')."-02-21',  '123552-55821-ff25', 1)"), mysql_error());

		// For employee2
		$this->assertTrue(mysql_query("INSERT INTO `hs_hr_hsp_payment_request` ($this->paymentRequestFields) " .
	    							  "VALUES (4, 1, 2, '".date('Y')."-02-01', 'Test provider', 'Tester', 'Just testing', '122', 'TestX', '12345GD', " .
	    							  "'1231, Test Grove, Test City', 'Test', '".date('Y')."-02-02',  '123552-55821-ff25', 1)"), mysql_error());

	    $this->assertTrue(mysql_query("INSERT INTO `hs_hr_hsp_payment_request` ($this->paymentRequestFields) " .
	    							  "VALUES (5, 1, 2, '".date('Y')."-02-10', 'Test provider', 'Tester', 'Just testing', '41', 'TestX', '12345GD', " .
	    							  "'1231, Test Grove, Test City', 'Test', '".date('Y')."-02-11',  '123552-55821-ff25', 1)"), mysql_error());


		$this->assertTrue(mysql_query("INSERT INTO hs_hr_hsp_summary VALUES(1, 1, 1, '".date('Y')."', 1, 1500, 50, 50, 0, 22)"), mysql_error());
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_hsp_summary VALUES(2, 2, 1, '".date('Y')."', 1, 2500, 75, 75, 0, 0)"), mysql_error());

		$this->assertTrue(mysql_query("UPDATE `hs_hr_config` SET `value` = '".(date('Y')-1)."-12-31' WHERE `key` = 'hsp_used_last_updated'"));
		$this->assertTrue(mysql_query("UPDATE `hs_hr_config` SET `value` = '1' WHERE `key` = 'hsp_current_plan'"));

		Hsp::updateUsed(date('Y')); // total_used is calculated by function and should be equal to expense sum of employee1 (150+100+127) plus existing value (22)

		$result = mysql_query("SELECT `total_used` FROM `hs_hr_hsp_summary` WHERE `summary_id` = 1");
		$resultArray = mysql_fetch_array($result);

		$this->assertEquals(399, $resultArray[0]);

		$result = mysql_query("SELECT `total_used` FROM `hs_hr_hsp_summary` WHERE `summary_id` = 2");
		$resultArray = mysql_fetch_array($result);

		$this->assertEquals(163, $resultArray[0]); // should be 163 (122+41)

    }

    public function testUpdateUsedForTwoPlans() {

		$this->assertTrue(mysql_query("TRUNCATE `hs_hr_employee`;", $this->connection), mysql_error());
        $this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_hsp_payment_request`"), mysql_error());
		$this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_hsp_summary`"), mysql_error());

		$this->assertTrue(mysql_query("INSERT INTO `hs_hr_employee` ($this->employeeFields) VALUES (1, '001', 'Arnold', 'Subasinghe', '', 'Arnold', 0, NULL, NULL, NULL, NULL, NULL, '', '', '', '', NULL, '', NULL, NULL, NULL, NULL, '', '', '', 'AF', '', '', '', '', '', '', NULL, NULL, '')"), mysql_error());
		$this->assertTrue(mysql_query("INSERT INTO `hs_hr_employee` ($this->employeeFields) VALUES (2, '002', 'Kalum', 'Kumara', '', 'Kal', 0, NULL, NULL, NULL, NULL, NULL, '', '', '', '', NULL, '', NULL, NULL, NULL, NULL, '', '', '', 'AF', '', '', '', '', '', '', NULL, NULL, '')"), mysql_error());

		// For employee1
		$this->assertTrue(mysql_query("INSERT INTO `hs_hr_hsp_payment_request` ($this->paymentRequestFields) " .
	    							  "VALUES (1, 1, 1, '".date('Y')."-02-01', 'Test provider', 'Tester', 'Just testing', '150', 'TestX', '12345GD', " .
	    							  "'1231, Test Grove, Test City', 'Test', '".date('Y')."-02-02',  '123552-55821-ff25', 1)"), mysql_error());

	    $this->assertTrue(mysql_query("INSERT INTO `hs_hr_hsp_payment_request` ($this->paymentRequestFields) " .
	    							  "VALUES (2, 3, 1, '".date('Y')."-02-10', 'Test provider', 'Tester', 'Just testing', '100', 'TestX', '12345GD', " .
	    							  "'1231, Test Grove, Test City', 'Test', '".date('Y')."-02-11',  '123552-55821-ff25', 1)"), mysql_error());

		$this->assertTrue(mysql_query("INSERT INTO `hs_hr_hsp_payment_request` ($this->paymentRequestFields) " .
	    							  "VALUES (3, 1, 1, '".date('Y')."-02-20', 'Test provider', 'Tester', 'Just testing', '150', 'TestX', '12345GD', " .
	    							  "'1231, Test Grove, Test City', 'Test', '".date('Y')."-02-21',  '123552-55821-ff25', 1)"), mysql_error());

		$this->assertTrue(mysql_query("INSERT INTO `hs_hr_hsp_payment_request` ($this->paymentRequestFields) " .
	    							  "VALUES (4, 3, 1, '".date('Y')."-02-20', 'Test provider', 'Tester', 'Just testing', '100', 'TestX', '12345GD', " .
	    							  "'1231, Test Grove, Test City', 'Test', '".date('Y')."-02-21',  '123552-55821-ff25', 1)"), mysql_error());

		$this->assertTrue(mysql_query("INSERT INTO hs_hr_hsp_summary VALUES(1, 1, 1, '".date('Y')."', 1, 1500, 50, 50, 0, 22)"), mysql_error());
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_hsp_summary VALUES(2, 1, 3, '".date('Y')."', 1, 2500, 75, 75, 0, 0)"), mysql_error());

		$this->assertTrue(mysql_query("UPDATE `hs_hr_config` SET `value` = '".(date('Y')-1)."-12-31' WHERE `key` = 'hsp_Used_last_updated'"));

		$this->assertTrue(mysql_query("UPDATE `hs_hr_config` SET `value` = '4' WHERE `key` = 'hsp_current_plan'"));

		Hsp::updateUsed(date('Y')); // total_used is calculated by function and should be equal to expense sum of employee1 (150+100+127) plus existed value (22)

		$result = mysql_query("SELECT `total_used` FROM `hs_hr_hsp_summary` WHERE `summary_id` = 1");
		$resultArray = mysql_fetch_array($result);

		$this->assertEquals(322, $resultArray[0]);

		$result = mysql_query("SELECT `total_used` FROM `hs_hr_hsp_summary` WHERE `summary_id` = 2");
		$resultArray = mysql_fetch_array($result);

		$this->assertEquals(200, $resultArray[0]); // should be 163 (122+41)

    }

    public function testUpdateStatus() {

		$this->assertTrue(mysql_query("TRUNCATE TABLE `hs_hr_hsp_summary`"), mysql_error());

		$this->assertNotNull(mysql_query("INSERT INTO `hs_hr_employee` VALUES (1, '001', 'Arnold', 'Subasinghe', '', 'Arnold', 0, NULL, NULL, NULL, NULL, NULL, '', '', '', '', NULL, '', NULL, NULL, NULL, NULL, '', '', '', 'AF', '', '', '', '', '', '', NULL, NULL, '')"));
		$this->assertNotNull(mysql_query("INSERT INTO `hs_hr_employee` VALUES (2, '002', 'Kalum', 'Kumara', '', 'Kal', 0, NULL, NULL, NULL, NULL, NULL, '', '', '', '', NULL, '', NULL, NULL, NULL, NULL, '', '', '', 'AF', '', '', '', '', '', '', NULL, NULL, '')"));

		// For employee1

		$this->assertTrue(mysql_query("INSERT INTO hs_hr_hsp_summary VALUES(1, 1, 1, '".date('Y')."', 1, 1500, 50, 50, 0, 22)"), mysql_error());
		$this->assertTrue(mysql_query("INSERT INTO hs_hr_hsp_summary VALUES(2, 2, 1, '".date('Y')."', 1, 2500, 75, 75, 0, 0)"), mysql_error());

		$this->assertTrue(mysql_query("UPDATE `hs_hr_config` SET `value` = '".(date('Y')-1)."-12-31' WHERE `key` = 'hsp_Used_last_updated'"));


		Hsp::updateStatus(1, 0);
		$result = mysql_query("SELECT `hsp_plan_status` FROM `hs_hr_hsp_summary` WHERE `summary_id` = 1");
		$resultArray = mysql_fetch_array($result);

		$this->assertEquals($resultArray[0], 0); // should be 0 (Halted)

		Hsp::updateStatus(1, 1);
		$result = mysql_query("SELECT `hsp_plan_status` FROM `hs_hr_hsp_summary` WHERE `summary_id` = 1");
		$resultArray = mysql_fetch_array($result);

		$this->assertEquals($resultArray[0], 1); // should be 1 (Active)

    }

}

// Call HspTest::main() if this source file is executed directly.
if (PHPUnit_MAIN_METHOD == 'HspTest::main') {
    HspTest::main();
}
?>
Back to Top