Testing if the command was actually scheduled might be a controversial question. Should we test if the scheduler is working and running tasks on time? Obviously no, it provided via framework and we can even see that the tests are present and integrate together.

But there is a part of the app that could be tested and it is if the command we expect is being placed into the scheduler. I have found a nice solution and modified it for Laravel 8:

use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Console\Scheduling\Event;

public function testIsAvailableInTheScheduler()
    $schedule = app()->make(Schedule::class);

    $events = collect($schedule->events())->filter(function (Event $event) {
        return stripos($event->description, 'PruneLogs');

    if ($events->count() == 0) {
        $this->fail('No events found');

    $events->each(function (Event $event) {
        // Every minute
        $this->assertEquals('* * * * *', $event->expression);

We also need to actually define the scheduled command in the App\Console\Kernel class:

protected function schedule(Schedule $schedule) {
  $schedule->call(new PruneLogs)->everyMinute();

For instance, the above will call the invokable object named PruneLogs every minute, making the above test pass. Jobs can be used the same way, simply by replacing call with job.

I have found the solution via Tinker, the command property was null, but the description what what I was after:

>>> app()->make(\Illuminate\Console\Scheduling\Schedule::class)->events();
=> [
     Illuminate\Console\Scheduling\CallbackEvent {#3496
       +command: null,
       +expression: "* * * * *",
       +timezone: "UTC",
       +user: null,
       +environments: [],
       +evenInMaintenanceMode: false,
       +withoutOverlapping: false,
       +onOneServer: false,
       +expiresAt: 1440,
       +runInBackground: false,
       +output: "/dev/null",
       +shouldAppendOutput: false,
       +description: "App\Jobs\GenerateSuggestion",
       +mutex: Illuminate\Console\Scheduling\CacheEventMutex {#3498
         +cache: Illuminate\Cache\CacheManager {#282},
         +store: null,
       +exitCode: null,

Hope that helps!