【问题标题】:Run Laravel Dusk from schedule (cron)从计划运行 Laravel Dusk (cron)
【发布时间】:2018-04-18 10:52:18
【问题描述】:

我需要使用 cron 运行 Laravel (5.6.13) Dusk 测试。

我已经设置了时间表,但它不起作用。

日志中没有错误或某些信息。可能是设置不正确?

从控制台手动运行时,一切正常。

\app\Console\Kernel.php:

class Kernel extends ConsoleKernel
{
    protected function schedule(Schedule $schedule)
    {
        $schedule->command('dusk tests/Browser/ProductComment.php')->everyFifteenMinutes();
    }

    protected function commands()
    {
        $this->load(__DIR__.'/Commands');

        require base_path('routes/console.php');
    }
}

【问题讨论】:

  • 你怎么知道它不起作用?你有错误吗?
  • 为什么要每 15 分钟运行一次测试?
  • @TheFallen> 所有测试都有日志系统,将信息(开始和结束时间)插入数据库。
  • 您应该使用->sendOutputTo('file.log') 保存执行的输出以查看发生了什么。

标签: laravel laravel-dusk


【解决方案1】:

必须直接用php执行

protected function schedule(Schedule $schedule)
{
    $schedule->exec('php ' . base_path('artisan') . ' dusk')->everyFifteenMinutes();
}

【讨论】:

    猜你喜欢
    • 2020-08-28
    • 2016-03-06
    • 1970-01-01
    • 1970-01-01
    • 2018-03-07
    • 2017-09-06
    • 1970-01-01
    • 2010-09-12
    相关资源
    最近更新 更多