Test fix
authorColeman Watts <coleman@civicrm.org>
Mon, 29 Jul 2013 04:18:59 +0000 (21:18 -0700)
committerColeman Watts <coleman@civicrm.org>
Mon, 29 Jul 2013 16:06:51 +0000 (09:06 -0700)
CRM/Core/DAO.php
tests/phpunit/api/v3/ACLPermissionTest.php

index 9fbd3900ac38a169329886fb2e96be79e62ee778..bbf4eebc875a4ec517bd7f7bf230fd98eb1fc3a5 100644 (file)
@@ -1317,10 +1317,12 @@ SELECT contact_id
             continue;
           }
           // Pick an option value if needed
-          $options = $daoName::buildOptions($dbName);
-          if ($options) {
-            $object->$dbName = key($options);
-            continue;
+          if ($value['type'] !== CRM_Utils_Type::T_BOOL) {
+            $options = $daoName::buildOptions($dbName, 'create');
+            if ($options) {
+              $object->$dbName = key($options);
+              continue;
+            }
           }
 
           switch ($value['type']) {
@@ -1331,7 +1333,6 @@ SELECT contact_id
               break;
 
             case CRM_Utils_Type::T_BOOL:
-            case CRM_Utils_Type::T_BOOLEAN:
               if (isset($value['default'])) {
                 $object->$dbName = $value['default'];
               }
index a7b9c287b952f0e76b5d2f43849e724863cb956b..d9e07c4898207073f50a12a5c2f9a1f8b84bd006 100644 (file)
@@ -67,7 +67,7 @@ class api_v3_ACLPermissionTest extends CiviUnitTestCase {
     unset($config->userPermissionClass->permissions);
   }
 /**
- * Function just tests that an empty where hook returns the 2 expected results
+ * Function tests that an empty where hook returns no results
  */
   function testContactGetNoResultsHook(){
     $this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereHookNoResults'));
@@ -91,10 +91,10 @@ class api_v3_ACLPermissionTest extends CiviUnitTestCase {
     $this->assertEquals(2, $result['count']);
   }
   /**
-   * Function just tests that an empty where hook returns the 2 expected results
+   * Function tests that deleted contacts are not returned
   */
   function testContactGetPermissionHookNoDeleted(){
-    $this->callAPISuccess('contact', 'create', array('id' => 2, 'is_deleted' => 1));
+    $result = $this->callAPISuccess('contact', 'create', array('id' => 2, 'is_deleted' => 1));print "\n";print_r($result);
     $this->hookClass->setHook('civicrm_aclWhereClause', array($this, 'aclWhereHookAllResults'));
     $result = $this->callAPISuccess('contact', 'get', array(
         'check_permissions' => 1,