CiviCase - Consistently use name "housing_support" and "adult_day_care_referral"
authorTim Otten <totten@civicrm.org>
Mon, 14 Jul 2014 03:06:42 +0000 (20:06 -0700)
committerTim Otten <totten@civicrm.org>
Mon, 14 Jul 2014 03:06:42 +0000 (20:06 -0700)
See:
 * http://forum.civicrm.org/index.php/topic,33512.0.html
 * CRM-14798

CRM/Case/xml/configuration.sample/housing_support.xml [moved from CRM/Case/xml/configuration.sample/HousingSupport.xml with 100% similarity]
tests/phpunit/Civi/CCase/SequenceListenerTest.php
tests/phpunit/CiviTest/CiviCaseTestCase.php
tests/phpunit/api/v3/CaseTest.php
tests/phpunit/custom_directories/templates/CRM/Case/xml/configuration/housing_support.xml [moved from tests/phpunit/custom_directories/templates/CRM/Case/xml/configuration/HousingSupport.xml with 100% similarity]
xml/templates/case_sample.tpl

index feb29273545c8366e9fdde042c5741c5adca6de2..36f78f866ce61eddd9ca252923a64e55e78131c6 100644 (file)
@@ -8,7 +8,7 @@ class SequenceListenerTest extends \CiviCaseTestCase {
   public function setUp() {
     parent::setUp();
     $this->_params = array(
-      'case_type' => 'Housing Support', // FIXME: $this->caseType,
+      'case_type' => $this->caseType,
       'subject' => 'Test case',
       'contact_id' => 17,
     );
index 8f80ebc335dab466f107f08a15d85491cb4a276b..eb28b6efc1b68e9bc6093aa9f101d8addfc6ddc0 100644 (file)
@@ -81,8 +81,9 @@ class CiviCaseTestCase extends CiviUnitTestCase {
       $this->optionValues[] = $activityTypes['id'];
     }
 
-    // TODO Our data seems inconsistent on whether name is "HousingSupport" or "housing_support"
-    $this->caseType = 'HousingSupport';
+    // We used to be inconsistent about "HousingSupport" vs "housing_support".
+    // Now, the rule is simply: use the "name" from "civicrm_case_type.name".
+    $this->caseType = 'housing_support';
     $this->caseTypeId = 1;
     $this->tablesToTruncate = array(
       'civicrm_activity',
index 4d9c6b0035d1c47730a9fdafaccfee1474982afa..5e56500a1ae822d97555adc850637a45d2c56ed7 100644 (file)
@@ -97,7 +97,7 @@ class api_v3_CaseTest extends CiviCaseTestCase {
     $params = $this->_params;
     // Test using label instead of value
     unset($params['case_type_id']);
-    $params['case_type'] = 'housing_support';
+    $params['case_type'] = $this->caseType;
     $result = $this->callAPISuccess('case', 'create', $params);
     $id = $result['id'];
 
@@ -116,7 +116,7 @@ class api_v3_CaseTest extends CiviCaseTestCase {
     $params = $this->_params;
     // Test using name instead of value
     unset($params['case_type_id']);
-    $params['case_type'] = 'housing_support';
+    $params['case_type'] = $this->caseType;
     $result = $this->callAPISuccess('case', 'create', $params);
     $id = $result['id'];
     $result = $this->callAPISuccess('case', 'get', array('id' => $id));
index ec6997a92d356a99ce871232a829a95342a9521f..e069bbdbf484d73f8317d1f8c9bceb07d4975b58 100644 (file)
@@ -15,8 +15,8 @@ SELECT @caseCompId := id FROM `civicrm_component` where `name` like 'CiviCase';
 SELECT @max_wt  :=  COALESCE ( max(weight), 0 ) from civicrm_case_type;
 
 INSERT IGNORE INTO `civicrm_case_type` (  `title`, `name`, `description`, `weight`, `is_reserved`, `is_active`) VALUES
-  ('{ts}Housing Support{/ts}', 'HousingSupport', '{ts}Help homeless individuals obtain temporary and long-term housing{/ts}', @max_wt + 1, 0, 1),
-  ('{ts}Adult Day Care Referral{/ts}', 'AdultDayCareReferral', '{ts}Arranging adult day care for senior individuals{/ts}', @max_wt + 2, 0, 1);
+  ('{ts}Housing Support{/ts}', 'housing_support', '{ts}Help homeless individuals obtain temporary and long-term housing{/ts}', @max_wt + 1, 0, 1),
+  ('{ts}Adult Day Care Referral{/ts}', 'adult_day_care_referral', '{ts}Arranging adult day care for senior individuals{/ts}', @max_wt + 2, 0, 1);
 
 -- /*******************************************************
 -- *