Ensure buildForm is called to assign values
authorEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 24 Nov 2021 06:31:04 +0000 (19:31 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Wed, 24 Nov 2021 06:31:36 +0000 (19:31 +1300)
tests/phpunit/CRM/Case/Form/CustomDataTest.php
tests/phpunit/CRM/Custom/Form/OptionTest.php

index 1e276558ef381f35a44df945642364fd1906459c..1385d139ddf6a3e55877ea4fb1947f3c2cfe6e0e 100644 (file)
@@ -334,7 +334,7 @@ class CRM_Case_Form_CustomDataTest extends CiviCaseTestCase {
    * Test that when custom case data is edited but not changed that it doesn't
    * create a meaningless empty activity.
    */
-  public function testCustomDataNoChangeNoActivity() {
+  public function testCustomDataNoChangeNoActivity(): void {
     // Create a custom group and field
     $customField = $this->callAPISuccess('custom_field', 'create', [
       'custom_group_id' => $this->custom_group['id'],
@@ -362,6 +362,7 @@ class CRM_Case_Form_CustomDataTest extends CiviCaseTestCase {
     // this is case type
     $form->set('subType', 1);
     $form->set('cid', $individual);
+    $form->buildForm();
     ob_start();
     $form->controller->_actions['display']->perform($form, 'display');
     ob_end_clean();
index 385dda5bcb27dfc6aa51becaa55cdffc571ebb9e..8117fa05498ede347ca7390a46142ff056b3e470 100644 (file)
@@ -9,7 +9,7 @@ class CRM_Custom_Form_OptionTest extends CiviUnitTestCase {
   /**
    * Test the `name` field doesn't get changed when editing an existing option.
    */
-  public function testEditCustomFieldOptionValue() {
+  public function testEditCustomFieldOptionValue(): void {
     // Create a custom field for contacts with some option choices
     $customGroup = $this->customGroupCreate(['extends' => 'Contact', 'title' => 'contact stuff']);
     $customField = $this->customFieldOptionValueCreate($customGroup, 'myCustomField');
@@ -28,6 +28,7 @@ class CRM_Custom_Form_OptionTest extends CiviUnitTestCase {
     $form->set('id', $optionValue['id']);
     $form->set('fid', $customField['id']);
     $form->set('gid', $customGroup['id']);
+    $form->buildForm();
 
     ob_start();
     $form->controller->_actions['display']->perform($form, 'display');