Closed webbj74 closed 10 years ago
Added methods that consume GET resources for domains in commit f7ac13457388d2a9a0f73ab8b5edc3e77d143ed1. @webbj74, I need to figure out your awesome Mock response strategy to add tests!
Added method to purge Varnish cache at 4271ec57820bd8927e85e55a7d5d2c1d988dfd4f.
@cpliakas -- I've followed the original unit test examples you provided, the change to check responses doesn't actually use a mock, it's just using a standard Guzzle event subscriber.
First add a callback function for the create_request event, like:
public function domainsCallListener(Event $e) {
$this->assertEquals('https://cloudapi.example.com/v1/sites/myhostingstage%3Amysitegroup/dev/domains.json', $e['request']->getUrl());
}
Since most of these URLs are similar in our tests, I use a const to alias the most common chunk:
$this->assertEquals(self::REQUEST_PATH . '/dev/domains.json', $e['request']->getUrl());
After instantiating the cloudapiclient, but before calling the domains method, add the domainsCallListener method as an event listener for client.create_request events:
$cloudapi->getEventDispatcher()->addListener('client.create_request', array($this, 'domainsCallListener'));
There's probably a more "phpunit" way to handle this using its built-in mocking capability, but this seemed like a quick and easy way to deal with it.
PRs in for add/delete domains and delete backups.
Remaining calls added at https://github.com/acquia/acquia-sdk-php/tree/18-refactor.
Testing system has been refactored to make it a little easier to write tests. Wrapper methods are also removed from the client for transparency, and the response objects are a little more DRY and provide methods to get the data returned so you know what is available.
Merged in branch. API is complete minus #13 and #24 which will be addressed in those issues.
The CloudApiClient class is missing methods for the following API functions