Details
-
Type: Sub-task
-
Status: Done/Fixed
-
Priority: Major
-
Resolution: Fixed/Completed
-
Affects Version/s: 3.1
-
Fix Version/s: 3.1
-
Component/s: Test suite
-
Labels:None
Description
In order to do this, go to this page: http://tests.dev.civicrm.org/trunk/coverage/api_v2_CustomGroup.php.html - this is information about which lines in api/v2/CustomGroup.php are covered by tests. Each line which is marked with orange colour is not "touched" by our test cases - we need to think about the way to test these specific scenarios.
Two examples:
1. Line 70: return civicrm_create_error( "params is not an array");
This line is not tested. It's enclosed in "! is_array($params)" condition - it means that we are not checking for scenario, where civicrm_custom_group_create is called with wrong params type, e.g. like this:
$params = 'a string';
$result = civicrm_custom_group_create( $params)
We basically need to add a test method which does that and assert for is_error = 1 and appropriate error message.
2. Line 196: a bunch of lines are not tested. Again, they are enclosed in condition:
isset( $params['option_values'] ) && is_array( $params['option_values'] )
So in order to test those few lines, we need to add a test method, which will call civicrm_custom_field_create with parameters, which have 'option_values' as array defined.
===
And so on - you need to look at coverage report and figure out what specific test methods need to be added in order to touch all the lines,