Rob Allen performs a cool test.

Recently I needed to test part of Slim that uses the built-in PHP functions header() and headers_sent(). To do this, I took advantage of PHP’s namespace resolution rules where it will find a function within the same namespace first before finding one with the same name in the global namespace.

https://akrabat.com/replacing-a-built-in-php-function-when-testing-a-component/