public function testIsJobInProcessOverThreashold() { Yii::app()->user->userModel = User::getByUsername('super'); $jobInProcess = new JobInProcess(); $jobInProcess->type = 'Test'; $this->assertTrue($jobInProcess->save()); //Set the createdDateTime as way in the past, so that it is over the threshold $sql = "update " . Item::getTableName() . " set createddatetime = '1980-06-03 18:33:03' where id = " . $jobInProcess->getClassId('Item'); ZurmoRedBean::exec($sql); $jobInProcessId = $jobInProcess->id; $jobInProcess->forget(); $jobInProcess = JobInProcess::getById($jobInProcessId); $this->assertTrue(JobsManagerUtil::isJobInProcessOverThreshold($jobInProcess, $jobInProcess->type)); $jobInProcess->delete(); //Test when a job is not over the threshold. $jobInProcess = new JobInProcess(); $jobInProcess->type = 'Test'; $this->assertTrue($jobInProcess->save()); $this->assertFalse(JobsManagerUtil::isJobInProcessOverThreshold($jobInProcess, $jobInProcess->type)); $jobInProcess->delete(); }