Test job dispatching by mocking the handler or asserting Queue::assertPushed() in Laravel.
Advanced Best Practices
// 1. Test names should describe expected behavior
public function testUserWithExpiredTrialCannotAccessPremium(): void {}
// 2. Use data providers to avoid duplication
#[DataProvider("statusCodes")]
public function testApiReturnsCorrectStatus(string $method, string $url, int $code): void {
$resp = $this->client->request($method, $url);
$this->assertEquals($code, $resp->getStatusCode());
}
// 3. Make assertions specific
// Bad: $this->assertTrue($user !== null);
// Good:
$this->assertNotNull($user);
$this->assertEquals("alice@example.com", $user->email);