Title: Add get + set for `$apiBase` to increase testability · Issue #27 · ConvertAPI/convertapi-library-php · GitHub
Open Graph Title: Add get + set for `$apiBase` to increase testability · Issue #27 · ConvertAPI/convertapi-library-php
X Title: Add get + set for `$apiBase` to increase testability · Issue #27 · ConvertAPI/convertapi-library-php
Description: 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.co...
Open Graph Description: 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 fol...
X Description: 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...
Opengraph URL: https://github.com/ConvertAPI/convertapi-library-php/issues/27
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Add get + set for `$apiBase` to increase testability","articleBody":"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:\r\n\r\n`ConvertApi::$apiBase = 'eu-v2.convertapi.com';`\r\n\r\nWe 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.\r\n\r\nThoughts about this? ~~I can open a PR if there's interest in this.~~ \r\nPR here: [https://github.com/ConvertAPI/convertapi-php/pull/28](https://github.com/ConvertAPI/convertapi-php/pull/28)\r\n","author":{"url":"https://github.com/DanielGSoftware","@type":"Person","name":"DanielGSoftware"},"datePublished":"2022-03-31T13:28:15.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/27/convertapi-library-php/issues/27"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:8bad4253-2927-8fa5-d451-981968f4a773 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EB1C:178CF3:2E21B98:3B46C6C:697DA737 |
| html-safe-nonce | 113c2d45e1897e87846715b2c33636780dcb010dbe2c6966aaced148eb6d9f32 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjFDOjE3OENGMzoyRTIxQjk4OjNCNDZDNkM6Njk3REE3MzciLCJ2aXNpdG9yX2lkIjoiOTMzNjcwMjU5MjA4ODU3NDAwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | d6f24efdb96a6620205f352329903ac5fc42cb61fbc6ae6c8ed81e32a9cc3ac1 |
| hovercard-subject-tag | issue:1188080360 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/ConvertAPI/convertapi-library-php/27/issue_layout |
| twitter:image | https://opengraph.githubassets.com/ab65ba3cf7947fb8cac22e7e1bec9b7602b7d62ae0c840f4e7190ad1ef19edef/ConvertAPI/convertapi-library-php/issues/27 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/ab65ba3cf7947fb8cac22e7e1bec9b7602b7d62ae0c840f4e7190ad1ef19edef/ConvertAPI/convertapi-library-php/issues/27 |
| og:image:alt | 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 fol... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | DanielGSoftware |
| hostname | github.com |
| expected-hostname | github.com |
| None | 60279d4097367e16897439d16d6bbe4180663db828c666eeed2656988ffe59f6 |
| turbo-cache-control | no-preview |
| go-import | github.com/ConvertAPI/convertapi-library-php git https://github.com/ConvertAPI/convertapi-library-php.git |
| octolytics-dimension-user_id | 37071453 |
| octolytics-dimension-user_login | ConvertAPI |
| octolytics-dimension-repository_id | 132747941 |
| octolytics-dimension-repository_nwo | ConvertAPI/convertapi-library-php |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 132747941 |
| octolytics-dimension-repository_network_root_nwo | ConvertAPI/convertapi-library-php |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 7c85641c598ad130c74f7bcc27f58575cac69551 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width