In my laravel project, I have this file in my tests directory:
tom_test.php
:
<?php
error_log("hello world");
I want to schedule this script to run every 'x' amount of time. I've seen this question from cyber8200. Unfortunately, I'm unsure how to make this test script to run.
Do I have to convert the test file to a class instead?
I would appreciate it if somebody would explicitly state what code needs to be added to the app/Console/Kernel.php
file.
I suspect it should resemble some of the code in the cyber8200 question
UPDATE
Thanks to Tim Lewis' comment, I've managed to get the cron job running (I think).
Unfortunately, I cannot see the "hello world" message being logged to the console.
Here is what I've done
I added a command as follows:
public function handle()
{
error_log("hello");
// echo base_path();
exit;
include base_path().'/tests/Browser/tom_test.php';
}
and this schedule function to the kernel:
protected function schedule(Schedule $schedule)
{
$schedule->command('tom_test')
->everyMinute();
}
The job seems to be quitting after one run, and no message is logged to the console.