CRM-18469, CRM-17984 - getTree regression on multiple integers separated by the cnrtl...
[civicrm-core.git] / tests / phpunit / CRM / Core / BAO / CustomGroupTest.php
index ac6962f058d7372abed0acb8497fb2ed7a15a10e..3d35f44251844e640011b9d7f5fb079a18701bee 100644 (file)
@@ -72,6 +72,25 @@ class CRM_Core_BAO_CustomGroupTest extends CiviUnitTestCase {
     $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.
    */
@@ -84,7 +103,7 @@ class CRM_Core_BAO_CustomGroupTest extends CiviUnitTestCase {
   }
 
   /**
-   * Test retrieve() with Empty Params
+   * Test retrieve() with Empty Params.
    */
   public function testRetrieveEmptyParams() {
     $params = array();