tests - enotice fix & move code to enable civicampaign to component
authorEileen <eileen@fuzion.co.nz>
Fri, 3 Jan 2014 03:32:31 +0000 (16:32 +1300)
committerEileen <eileen@fuzion.co.nz>
Fri, 3 Jan 2014 03:32:31 +0000 (16:32 +1300)
tests/phpunit/CiviTest/CiviUnitTestCase.php
tests/phpunit/api/v3/ActivityTest.php

index 0c83a0cb2d04c601564b484d31a7d5874efe0d69..37d667bb4d90efa83c2f5479fdd42408dfa0d967 100644 (file)
@@ -580,7 +580,7 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
   function assertAttributesEquals($expectedValues, $actualValues, $message = NULL) {
     foreach ($expectedValues as $paramName => $paramValue) {
       if (isset($actualValues[$paramName])) {
-        $this->assertEquals($paramValue, $actualValues[$paramName], "Value Mismatch On $paramName - value 1 is $paramValue  value 2 is {$actualValues[$paramName]}");
+        $this->assertEquals($paramValue, $actualValues[$paramName], "Value Mismatch On $paramName - value 1 is " . print_r($paramValue, TRUE) . "  value 2 is " . print_r($actualValues[$paramName], TRUE) );
       }
       else {
         $this->fail("Attribute '$paramName' not present in actual array.");
@@ -1808,6 +1808,17 @@ class CiviUnitTestCase extends PHPUnit_Extensions_Database_TestCase {
     return $this->callAPISuccess('Note', 'create', $params);
   }
 
+  /**
+   * Enable CiviCampaign Component
+   */
+  function enableCiviCampaign() {
+    CRM_Core_BAO_ConfigSetting::enableComponent('CiviCampaign');
+    // force reload of config object
+    $config = CRM_Core_Config::singleton(TRUE, TRUE);
+    //flush cache by calling with reset
+    $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name', TRUE);
+  }
+
   /**
    * Create test generated example in api/v3/examples.
    * To turn this off (e.g. on the server) set
index ec5490bdcdf11ef904a2ef0ffe27489aea82ce6f..b2840bb2a234bbc66bd58bad5b0cb63951f55e56 100644 (file)
@@ -49,7 +49,6 @@ class api_v3_ActivityTest extends CiviUnitTestCase {
   protected $test_activity_type_value;
   protected $_contactID;
 
-  public $_eNoticeCompliant = TRUE;
   /**
    *  Test setup for every test
    *
@@ -297,11 +296,7 @@ class api_v3_ActivityTest extends CiviUnitTestCase {
    *  Test civicrm_activity_create() with valid parameters - use type_id
    */
   function testActivityCreateCampaignTypeID() {
-    CRM_Core_BAO_ConfigSetting::enableComponent('CiviCampaign');
-    // force reload of config object
-    $config = CRM_Core_Config::singleton(TRUE, TRUE);
-    //flush cache by calling with reset
-    $activityTypes = CRM_Core_PseudoConstant::activityType(TRUE, TRUE, TRUE, 'name', TRUE);
+    $this->enableCiviCampaign();
 
     $defaults = array();