$subTypes = array();
}
else {
- $subTypes = explode(',', $subTypes);
+ if (stristr(',', $subTypes)) {
+ $subTypes = explode(',', $subTypes);
+ }
+ else {
+ $subTypes = explode(CRM_Core_DAO::VALUE_SEPARATOR, trim($subTypes, CRM_Core_DAO::VALUE_SEPARATOR));
+ }
}
}
$this->fail('There is no such thing as a small kind bank');
}
+ /**
+ * Test calling getTree with contact subtype data.
+ *
+ * Note that the function seems to support a range of formats so 3 are tested. Yay for
+ * inconsistency.
+ */
+ public function testGetTreeCampaignSubType() {
+ $this->campaignCreate();
+ $this->campaignCreate();
+ $customGroup = $this->CustomGroupCreate(array(
+ 'extends' => 'Campaign',
+ 'extends_entity_column_value' => '\ 11\ 12\ 1'
+ ));
+ $customField = $this->customFieldCreate(array('custom_group_id' => $customGroup['id']));
+ $result1 = CRM_Core_BAO_CustomGroup::getTree('Campaign', NULL, NULL, NULL, '\ 11\ 12\ 1');
+ $this->assertEquals('Custom Field', $result1[$customGroup['id']]['fields'][$customField['id']]['label']);
+ $this->customGroupDelete($customGroup['id']);
+ }
+
/**
* Test calling getTree with contact subtype data.
*/
}
/**
- * Test retrieve() with Empty Params
+ * Test retrieve() with Empty Params.
*/
public function testRetrieveEmptyParams() {
$params = array();