PHPUnit: Mock sleep() in 2 Ways Without Waiting

📰 Dev.to · Recca Tsai

When sleep() slows PHPUnit tests, extract a Clock class and use Mockery spy to replace it, or use php-mock to mock the built-in function with no code changes.

Published 3 Mar 2026
Read full article → ← Back to Reads