static function set_config_dir($dir) { self::$config_dir = $dir; }
/** * Set up a recurring action with frequency of 1 minute. The start time is 55 seconds ago, so the * first execution is in a few seconds. Get the first execution output, then delete it. In another minute, * check the output is back again. * @return void */ function testRecurringExecution() { echo "TESTRECURRINGEXECUTION\n"; $t = date("d-M-Y H:i:s", time() - 55); // 55 seconds ago $id = "testrecurring"; Chronos::add(array(new ChronosScheduledAction(array("timeSpecification" => new ChronosTimeRecurring(array("startTime" => $t, "frequency" => "minutely", "interval" => 1)), "actionType" => "method", "method" => 'ChronosTest::staticTestMethod', "parameters" => array("id" => $id))))); $filename = TEMP_FOLDER . "/chronos_test_" . $id; if (file_exists($filename)) { unlink($filename); } // run asynch for 75 seconds. $this->runScheduledExecutor(75, true); // check file doesn't exist to start $this->assertTrue(!file_exists($filename), "output file doesnt exist to start"); sleep(10); // check exists, delete $this->assertTrue(file_exists($filename), "output file exists for first execution"); unlink($filename); sleep(60); // check exists again $this->assertTrue(file_exists($filename), "output file exists for second execution"); unlink($filename); }