Merge pull request #17920 from eileenmcnaughton/dupe
[civicrm-core.git] / tests / phpunit / api / v4 / Action / BasicCustomFieldTest.php
index fbed754eebc01374bd0805cb511ea38ed8f1fa0a..991f5609ff6f7b675e4bf47f9165f1b06e412037 100644 (file)
@@ -140,10 +140,18 @@ class BasicCustomFieldTest extends BaseCustomValueTest {
       ->addWhere('MyContactFields.FavFood', '=', 'Cherry')
       ->execute()
       ->first();
-
     $this->assertArrayHasKey('MyContactFields.FavColor', $contact);
     $this->assertEquals('Red', $contact['MyContactFields.FavColor']);
 
+    // By default custom fields are not returned
+    $contact = Contact::get(FALSE)
+      ->addWhere('id', '=', $contactId1)
+      ->addWhere('MyContactFields.FavColor', '=', 'Red')
+      ->addWhere('MyContactFields.FavFood', '=', 'Cherry')
+      ->execute()
+      ->first();
+    $this->assertArrayNotHasKey('MyContactFields.FavColor', $contact);
+
     // Update 2nd set and ensure 1st hasn't changed
     Contact::update()
       ->addWhere('id', '=', $contactId1)
@@ -166,7 +174,7 @@ class BasicCustomFieldTest extends BaseCustomValueTest {
       ->addValue('MyContactFields.FavColor', 'Blue')
       ->execute();
     $contact = Contact::get(FALSE)
-      ->addSelect('MyContactFields.FavColor', 'MyContactFields2.FavColor', 'MyContactFields.FavFood', 'MyContactFields2.FavFood')
+      ->addSelect('custom.*')
       ->addWhere('id', '=', $contactId1)
       ->execute()
       ->first();