One flaky test split into three

A test asserting three things across two systems, failing intermittently for three years, split into three tests that each assert one.

// before: one test, three failure modes
public function testAPaymentIsCapturedAndTheOrderIsMarkedPaid(): void
{
    $this->service->capture($order);

    self::assertTrue($order->fresh()->isPaid());
    self::assertDatabaseHas('payments', [...]);
    Queue::assertPushed(SendReceipt::class);
}

// after: three tests, and only one of them was flaky

Splitting is diagnosis rather than a fix — it identifies which of three assertions is unreliable, which the combined version could not. The queue assertion was the flaky one and the cause was a genuine race in the code rather than in the test, which took two days to find and had been in production since 2023.