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