Skip to content

Instantly share code, notes, and snippets.

@eileenmcnaughton
Last active January 24, 2016 23:51
Show Gist options
  • Save eileenmcnaughton/d4540c46af2341cf1256 to your computer and use it in GitHub Desktop.
Save eileenmcnaughton/d4540c46af2341cf1256 to your computer and use it in GitHub Desktop.
1) test up methodology
We are leaning towards starting with one or 2 api & getting them & their tests going & then refining & doing a few more
How do we clean up the test classes? Scenario library? Require php 5.4 & use traits - it could be an option to make v4 require 5.4 even
if core does not initially)
2) use class api rather than procedural array based as a starting point?
$api = new CiviCRM_API4($authParams);
$contact = $api->Contact('create, $params);
$emails = $api->Email('get', $params);
- defaults? $api->setDefaults('check_permissions' => 0, 'limit' => 50) or $api->setDefaults('get', array('check_permissions' => 0, 'limit' => 50))
(or does that set up up for error)
3) return a class?
$contact->values;
$contact->display_name ?
4) make check_permissions required for php?
5) inputs
civicrm_api4('Contact', 'get', array(
'filters' => array('contact_type' => 'Individual'),
'return' => array('id', 'sort_name'),
'sort' => array('sort_name DESC'),
'check_permissions' => 1,
);
6) ditch wrapper in output
One more thought - writing the tests will actually be really revealing on what is convenient or not - we don't need to think about cased beyond the tests for now.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment