Attempt to add test for custom group that extends multiple subtype
authorSeamus Lee <seamuslee001@gmail.com>
Fri, 20 May 2016 10:40:22 +0000 (10:40 +0000)
committerSeamus Lee <seamuslee001@gmail.com>
Fri, 20 May 2016 10:43:56 +0000 (10:43 +0000)
tests/phpunit/CRM/Core/BAO/CustomGroupTest.php

index 03ef858c5ab4cf290859724f2db3fe0753f9c729..43f35d07126f1f17d9131db8fcc4d604af6f849d 100644 (file)
@@ -101,6 +101,17 @@ class CRM_Core_BAO_CustomGroupTest extends CiviUnitTestCase {
     $this->callAPISuccess('ContactType', 'delete', array('id' => $contactType['id']));
   }
 
+  public function testGetTreetContactSubTypeForMultipleSubTypes() {
+    $contactType1 = $this->callApiSuccess('ContactType', 'create', array('name' => 'Big Bank', 'label' => 'biggee', 'parent_id' => 'Organization'));
+    $contactType2 = $this->callAPISuccess('ContactType', 'create', array('name' => 'Small Bank', 'label' => 'small', 'parent_id' => 'Organization'));
+    $customGroup = $this->CustomGroupCreate(array('extends' => 'Organization', 'extends_entity_column_value' => array('Big_Bank', 'Small_Bank')));
+    $customField = $this->customFieldCreate(array('custom_group_id' => $customGroup['id']));
+    $result1 = CRM_Core_BAO_CustomGroup::getTree('Organization', NULL, NULL, NULL, array('Big_Bank'));
+    $this->assertEquals('Custom Field', $result1[$customGroup['id']]['fields'][$customField['id']]['label']);
+    $this->customGroupDelete($customGroup['id']);
+    $this->callAPISuccess('ContactType', 'delete', array('id' => $contactType['id']));
+  }
+
   /**
    * Test calling getTree with contact subtype data.
    *