A quick and easy way to ensure your tests don’t have any unwanted side-effects is to randomise the order in which they run. PHPUnit makes this easy.

<phpunit executionOrder="random"></phpunit>

Alternatively, you can pass the --order-by=random flag to the command-line test runner.

Try this with any sizeable test suite, and there’s a decent chance you’ll see a few unexpected failures.