You are here

protected function AttachmentTest::createFileCustomField in Webform CiviCRM Integration 8.5

Create file custom fields.

1 call to AttachmentTest::createFileCustomField()
AttachmentTest::addAttachmentOnContact in tests/src/FunctionalJavascript/AttachmentTest.php
Add 3 attachments to the contact.

File

tests/src/FunctionalJavascript/AttachmentTest.php, line 50

Class

AttachmentTest
Tests submitting a Webform with CiviCRM: Contact with File.

Namespace

Drupal\Tests\webform_civicrm\FunctionalJavascript

Code

protected function createFileCustomField() {
  $this->_cg = civicrm_api3('CustomGroup', 'create', [
    'title' => "Attach Files",
    'extends' => "Contact",
  ]);
  foreach ([
    'File1',
    'File2',
    'File3',
  ] as $f) {
    $this->_cf[$f] = civicrm_api3('CustomField', 'create', [
      'custom_group_id' => $this->_cg['id'],
      'label' => "Upload " . $f,
      'data_type' => "File",
      'html_type' => "File",
    ]);
  }
}