Hi,
I'm trying to write some unit tests for a class that connects to an API.
What I want to do is alter the class so that instead of actually connecting to the API, it instead loads a pre-fetched constant fixture. The method within the class that actually does the cURL request and returns the data is protected, and this is the one I want to change to instead return the contents of the fixture file.
My question is what's the best way to do this?
I've read about mock objects in PHPUnit, but because the method I want to change is internal and protected, I don't think I can use those right?
Am I correct in assuming I will need to extend the class and alter the method myself?
Thanks.