
PCOV vs Xdebug for Coverage: The CI Speed Difference Nobody Measures
Xdebug collects coverage the slow way. PCOV is a coverage-only driver that skips the overhead. Here is the difference and when you still need Xdebug.
Tag archive

Xdebug collects coverage the slow way. PCOV is a coverage-only driver that skips the overhead. Here is the difference and when you still need Xdebug.

Line coverage says 100% and the bug still shipped. Infection measures whether your tests actually assert anything.
Pest 3 and PHPUnit 11 use the same engine. The ergonomics gap is real, but so is the migration cost. Here's where each wins.

Side-by-side: Pest 3 it() blocks and arch tests vs PHPUnit 11 attributes, both testing the same hexagonal use case with in-memory adapters.

Your PHPUnit suite is slow because every test boots Laravel and migrates MySQL. Here is the in-memory + contract-test pattern that fixes it.
import Tabs from '@theme/Tabs'; import TabItem from '@theme/TabItem'; WordPress 6.9 added...
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.

Testing complex domain workflows in Laravel doesn’t have to mean brittle, overly mocked tests. I explain how using real database state with minimal mocks leads to more maintainable and reliable test suites.
Mocking IteratorAggregate breaks foreach in PHPUnit. Return an ArrayObject from the mocked getIterator method to make foreach iterate over test data correctly.
Assertions inside a closure pass silently even if never called. Wrap the closure in Mockery::spy to verify invocation count and arguments in PHPUnit tests.
When a method uses random_int internally, Mockery::capture with passthru captures the intermediate value so you can compute the expected result and assert it.
Fake $_SERVER in Laravel feature tests by passing server vars per-request, or use withServerVariables() to apply them globally for the entire test method.