Needs work
Project:
Mockable: Mock objects for Drupal
Version:
7.x-1.x-dev
Component:
Code
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
29 Sep 2013 at 11:44 UTC
Updated:
1 Oct 2013 at 16:59 UTC
A common usecase is mocking external systems; which are often called via drupal_http_request().
Instead of prividing an example on how to mock those (with mockable_crm_example), it might be relevant to split mockable_crm_example into two modules: mockable_crm_example and a new mockable_http_request module, which does the heavy lifting.
drupal_http_request()'s documentation shows how the function can be overrided without requiring modules to change their code (see also #2100519: Don't require modules to change their code).
$override_function = variable_get('drupal_http_request_function', FALSE);
if (!empty($override_function) && function_exists($override_function)) {
return $override_function($url, $options);
}
Comments
Comment #1
alberto56 commentedI created a branch 2100523 for this.
Comment #2
alberto56 commentedNow on the main 7.x-1.x-unstable branch, I deleted the branch 2100523