在laravel的cron作业调度程序中运行phpunit的测试

问题描述 投票:0回答:1

我已经在Google上搜索了一种解决方案,以使用调度程序在laravel kernel.php中运行我的testsunit and feature)。但是我没有机会,有人可以对此情况提出建议吗?场景:每天在tests/00:00目录中运行我的测试,例如:

 $schedule->call(function(){$this->runAllMyTests($please);})->dailyAt('00:00');


或(我知道这很像个玩笑,但希望这样做):

$schedule->call(function () {
   Artisan::call('./vendor/bin/phpunit --filter SubmitOrdetTest');
})->dailyAt('00:00');

最终目的是每天晚上运行测试,并报告测试失败或成功的情况,以便可以向某人发送报告邮件,任何建议都是愉快的。

laravel phpunit tdd
1个回答
0
投票

PHPUnit不是一个熟练的命令,而是一个php脚本,需要从命令行或任何其他方式执行。

使用Scheduling Shell Commands

$schedule->exec('./vendor/bin/phpunit')->dailyAt('00:00');
© www.soinside.com 2019 - 2024. All rights reserved.