Configure a GitHub Actions CI pipeline: install PHP, run PHPStan, PHPUnit, and upload coverage.
Testing Jobs and Queues
// Plain PHP — test the job class directly
public function testJobSendsEmail(): void {
$mailer = $this->createMock(Mailer::class);
$mailer->expects($this->once())->method("send");
$job = new SendWelcomeEmail($this->user);
$job->handle($mailer);
}
// Laravel
Queue::fake();
$this->post("/register", ["email"=>"a@b.com"]);
Queue::assertPushed(SendWelcomeEmail::class);
Queue::assertNotPushed(SendAdminAlert::class);