Skip to content

Commit 5a785d1

Browse files
committed
Add missing test cron job
1 parent 18b69a5 commit 5a785d1

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

examples/TestCronJob.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?php
2+
/**
3+
* Test Cron Job
4+
*
5+
* Simple test job that logs a message and succeeds.
6+
* Used by bin/test-cron.php for basic functionality testing.
7+
*/
8+
9+
class TestCronJob extends \Kyte\Core\CronJobBase
10+
{
11+
public function execute()
12+
{
13+
$this->log("Test job started");
14+
$this->log("Current time: " . date('Y-m-d H:i:s'));
15+
16+
// Get execution info
17+
$execution = $this->getExecution();
18+
$this->log("Execution ID: " . $execution['id']);
19+
$this->log("Scheduled time: " . date('Y-m-d H:i:s', $execution['scheduled_time']));
20+
21+
// Simulate some work
22+
sleep(2);
23+
24+
// Send a heartbeat to extend our lease
25+
$this->heartbeat();
26+
27+
// More work
28+
sleep(2);
29+
30+
$this->log("Test job completed successfully");
31+
32+
return "Test job finished at " . date('Y-m-d H:i:s');
33+
}
34+
}

0 commit comments

Comments
 (0)