artisan('uwil:upsert-shops-hollydays') // THEN ->assertSuccessful(); Bus::assertDispatched(UpsertShopsPickupExceptionsUsingApiForYear::class); }); it('dispatches the job for the specified numeric year', function (): void { // GIVEN /** @var \Tests\TestCase $this */ Bus::fake(); // WHEN $this->artisan('uwil:upsert-shops-hollydays', ['year' => '2027']) // THEN ->assertSuccessful(); Bus::assertDispatched(UpsertShopsPickupExceptionsUsingApiForYear::class); }); it('fails when year argument is not numeric', function (): void { // GIVEN /** @var \Tests\TestCase $this */ Bus::fake(); // WHEN $this->artisan('uwil:upsert-shops-hollydays', ['year' => 'abc']) // THEN ->expectsOutput('The year must be a number') ->assertFailed(); Bus::assertNotDispatched(UpsertShopsPickupExceptionsUsingApiForYear::class); });