twilio / twilio-php

A PHP library for communicating with the Twilio REST API and generating TwiML.
MIT License
1.56k stars 559 forks source link

Make api URL configurable #508

Closed TBlindaruk closed 6 years ago

TBlindaruk commented 6 years ago

Feature Request

Hi,

I have written some functionality which contains communication with twillo via php-sdk. When I have started API tests writing, then I got a problem, that I could not mock HTTP requests which were called within this SDK, since all URL is hardcoded, and cannot be configurable.

So, I have a proposition to give people the possibility to change the URL

dinamic commented 6 years ago

Not sure what you are trying to do there, but why don't you just pass-in a custom http client?

IMO you should not be changing the URL at all. What you need to do is to mock the twilio client and make assertions on the different methods that get called, the parameters they are called with, etc.