CRM-20858: Fix Failing Test on Custom Field Merge
authorCamilo Rodriguez <camilo@compucorp.co.uk>
Wed, 9 Aug 2017 17:28:54 +0000 (17:28 +0000)
committerCamilo Rodriguez <camilo@compucorp.co.uk>
Wed, 9 Aug 2017 17:28:54 +0000 (17:28 +0000)
Test for merging custom fields with is_view flag on was failing. This was
happening because the same field was being used on prior tests, setting the
is_view flag at the start of the failing test. Fixed by creating a new custom
field with the is_view flag set as 1, and using that field on the test.

tests/phpunit/api/v3/JobTestCustomDataTest.php [changed mode: 0644->0755]

old mode 100644 (file)
new mode 100755 (executable)
index 2f656fd..54f6523
@@ -240,7 +240,8 @@ class api_v3_JobTestCustomDataTest extends CiviUnitTestCase {
    */
   public function testBatchMergeDateCustomFieldHandlingIsView() {
     $this->customFieldCreate(array(
-      'id' => $this->customFieldID,
+      'label' => 'OnlyView',
+      'custom_group_id' => $this->customGroupID,
       'is_view' => 1,
     ));
     $customFieldLabel = 'custom_' . $this->customFieldID;
@@ -249,7 +250,7 @@ class api_v3_JobTestCustomDataTest extends CiviUnitTestCase {
     $result = $this->callAPISuccess('Job', 'process_batch_merge', array());
     $this->assertEquals(1, count($result['values']['merged']));
     $contact = $this->callAPISuccess('Contact', 'getsingle', array('id' => $contactID, 'return' => $customFieldLabel));
-    $this->assertEquals('2012-11-03', $contact[$customFieldLabel]);
+    $this->assertEquals('2012-11-03 00:00:00', $contact[$customFieldLabel]);
   }
 
   /**