-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audit and Expand Error handling In CloudFlareAPI class #16
Comments
You could probably add tests that mock Guzzle, and force a specific response exception to be thrown. I think.... $client = $this->getMockBuilder('\GuzzleHttp\Client')
->disableOriginalConstructor()
->getMock();
$client->expects($this->any())
->method('request')
// Probably need to pass in some mocks into the exception object too.
->will($this->throwException(new \GuzzleHttp\Exception\RequestException)); Also, depending on guzzle "dev-master" might not be the best for stability. |
@mradcliffe: I like the way you think. There are some primitive phpunit tests that have been added along those lines. The constructor allows a mock object to be passed in: See tests here:
any chance you are interested in digging into this issue? On the issue of tracking dev-master. You are correct. I'm going to add an issue to pin to a version for beta. |
I probably won't be able to get to it soon, but if I can, I'll fork and submit a Pull Request. I have been enjoying writing tests these days. |
Business Requirements
Background
The PHP SDK attempts to consolidate as much exception handling into a central location here:
https://github.com/d8-contrib-modules/cloudflarephpsdk/blob/master/src/ApiEndpoints/CloudFlareAPI.php#L123
The code is designed to throw typed exceptions when a problem happens and expects the implementing code to handle these exceptions:
https://github.com/d8-contrib-modules/cloudflarephpsdk/tree/master/src/Exceptions
Technical Requirements
https://github.com/d8-contrib-modules/cloudflarephpsdk/blob/master/tests/ApiEndpoints/ZoneApiTest.php
and
https://github.com/d8-contrib-modules/cloudflarephpsdk/blob/master/tests/ApiEndpoints/ZoneSettingsApiTest.php
The text was updated successfully, but these errors were encountered: