Unit test of a function using curl fails

I have a unit test that calls a method that uses curl. It fails on the line that calls curl_init() with

Fatal error: Call to undefined function curl_init()

This is the expected error if the php curl module is not installed/enabled. However it is enabled and the method works fine when called in normal use.

Any ideas why?

Thanks for helping

Check that curl is also enabled in the php.ini that is used for CLI. To find the right ini file, use:

php --ini

Thanks Mike. That did the trick.