I have a function that makes HTTP requests with cURL that falls back to file_get_contents()
if cURL is not available on the system.
I would like to write unit tests for this function (utilizing PHPUnit) where cURL is available for some tests, and not available for others.
Is it possible to programmatically disable PHP functions, such as curl_init()
?
I know I can use the disable_functions
setting in php.ini, but I was hoping to find a way to do unit tests without reconfiguring PHP in between runs.