From e8c38773959499d22ffbf63d31a5058aefa941c3 Mon Sep 17 00:00:00 2001 From: Seamus Lee Date: Fri, 12 Nov 2021 11:59:43 +1100 Subject: [PATCH] [NFC] dev/mail#103 Add in unit test to demonstate issue with APIv4 and joins Add comment to test along the lines from Coleman and fix test cleanup Update test to extend from BaseCustomValueTest --- .../api/v4/Entity/ContactCustomJoinTest.php | 53 +++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 tests/phpunit/api/v4/Entity/ContactCustomJoinTest.php diff --git a/tests/phpunit/api/v4/Entity/ContactCustomJoinTest.php b/tests/phpunit/api/v4/Entity/ContactCustomJoinTest.php new file mode 100644 index 0000000000..2a92ec0d3a --- /dev/null +++ b/tests/phpunit/api/v4/Entity/ContactCustomJoinTest.php @@ -0,0 +1,53 @@ +setValues([ + 'name' => 'D - Identification_20', + 'table_name' => 'civicrm_value_demographics', + 'title' => 'D - Identification', + 'extends' => 'Individual', + ])->execute(); + \CRM_Core_DAO::executeQuery("UPDATE civicrm_custom_group SET name = 'D - Identification_20' WHERE id = %1", [1 => [$customGroup[0]['id'], 'Integer']]); + $customField = CustomField::create()->setValues([ + 'label' => 'Test field', + 'custom_group_id' => $customGroup[0]['id'], + 'html_type' => 'Text', + 'data_type' => 'String', + ])->execute(); + Contact::get()->addSelect('*')->addSelect('custom.*')->execute(); + } + +} -- 2.25.1