You are here

protected function AttachmentTest::addAttachmentOnContact in Webform CiviCRM Integration 8.5

Add 3 attachments to the contact.

1 call to AttachmentTest::addAttachmentOnContact()
AttachmentTest::setUp in tests/src/FunctionalJavascript/AttachmentTest.php

File

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

Class

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

Namespace

Drupal\Tests\webform_civicrm\FunctionalJavascript

Code

protected function addAttachmentOnContact() {
  $this
    ->createFileCustomField();
  $this->fileParams = $this
    ->getFileParams();
  $cParams = [
    'id' => $this->rootUserCid,
  ];
  foreach ($this->fileParams as $name => $file) {
    $attachment = civicrm_api3('Attachment', 'create', $file);
    $cParams["custom_{$this->_cf[$name]['id']}"] = $attachment['id'];
  }
  civicrm_api3('Contact', 'create', $cParams);
}