Truncating every table between tests costs a statement per table per test; a transaction and a rollback is one of each.
use IlluminateFoundationTestingRefreshDatabase;
class OrderRepositoryTest extends TestCase
{
use RefreshDatabase;
}
// where it breaks down:
// code under test that commits explicitly
// tests of transaction behaviour itself
// a SECOND connection — a spawned worker, a browser test
The second-connection case produces a genuinely confusing failure: the data exists inside the uncommitted transaction and is invisible to anything connecting separately, so a test that spawns a process sees an empty database. Those tests need the truncating variant and are worth isolating into their own suite rather than fighting. On one project the switch took the integration suite from four minutes to fifty seconds.