} else { $this->assertTrue(mysql_query("UPDATE `hs_hr_config` SET `value` = 'Yes' WHERE `key` = 'timesheet_period_set'")); } $this->assertTrue(Config::getTimePeriodSet()); $this->assertTrue(mysql_query("UPDATE `hs_hr_config` SET `value` = 'No' WHERE `key` = 'timesheet_period_set'")); $this->assertFalse(Config::getTimePeriodSet()); } public function testSetLeaveBroughtForward() { Config::setLeaveBroughtForward(date('Y')); $result = mysql_query("SELECT `key`, `value` FROM `hs_hr_config` WHERE `key` = 'LeaveBroughtForward" . date('Y') . "'"); $row = mysql_fetch_array($result); $this->assertEquals("LeaveBroughtForward" . date('Y'), $row['key'], "Key is incorrect"); $this->assertEquals("set", $row['value'], "Value is incorrect"); // Setting LeaveBroughtForward should not be allowed more than once try { Config::setLeaveBroughtForward(date('Y')); $this->fail("Setting LeaveBroughtForward is allowed more than once"); } catch (Exception $e) { } } public function testGetLeaveBroughtForward() { $this->assertTrue(Config::getLeaveBroughtForward(date('Y') + 1)); $this->assertFalse(Config::getLeaveBroughtForward('4000')); } } // Call ConfigTest::main() if this source file is executed directly. if (PHPUnit_MAIN_METHOD == 'ConfigTest::main') { ConfigTest::main(); }