You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add get + set for $apiBase to increase testability #27
We're currently integrating the ConvertAPI into our project. When writing a unit test, we tried to mock the ConvertApi class. This works fine to a certain extend. In a piece of code we have the following:
ConvertApi::$apiBase = 'eu-v2.convertapi.com';
We use PhpUnit and Mockery to write tests, and currently mocking static properties is not supported. After some experimenting, we found the best solution would be to add a setter (like setApiSecret) so that we can finish our unit test. I think other people can also benefit from this, as it's not possible to write a unit test if you set a custom apiBase.
Thoughts about this? I can open a PR if there's interest in this.
PR here: #28
changed the title [-]Add setter for $apiBase to support for better testibility[/-][+]Add get + setsetter for $apiBase to support for better testibility[/+]on Mar 31, 2022
changed the title [-]Add get + setsetter for $apiBase to support for better testibility[/-][+]Add get + set for `$apiBase` to increase testability[/+]on Mar 31, 2022
Activity
[-]Add setter for $apiBase to support for better testibility[/-][+]Add get + setsetter for $apiBase to support for better testibility[/+][-]Add get + setsetter for $apiBase to support for better testibility[/-][+]Add get + set for `$apiBase` to increase testability[/+]DanielGSoftware commentedon Apr 21, 2022
Any update on this?
laurynas-convertapi commentedon Jun 26, 2022
@DanielGSoftware Thanks for the PR. Included in release v1.6.0.
https://github.com/ConvertAPI/convertapi-php/releases/tag/v1.6.0