protected function EventTest::createCustomFields in Webform CiviCRM Integration 8.5
1 call to EventTest::createCustomFields()
- EventTest::testParticipantContactReference in tests/
src/ FunctionalJavascript/ EventTest.php - Test contact reference field for participants.
File
- tests/
src/ FunctionalJavascript/ EventTest.php, line 32
Class
- EventTest
- Tests submitting a Webform with CiviCRM: Contact with Event.
Namespace
Drupal\Tests\webform_civicrm\FunctionalJavascriptCode
protected function createCustomFields() {
$this->cg = $this
->createCustomGroup([
'title' => 'Participant CG',
'extends' => 'Participant',
]);
//Add text custom field.
$params = [
'custom_group_id' => $this->cg['id'],
'label' => 'Text',
'name' => 'text',
'data_type' => 'String',
'html_type' => 'Text',
'is_active' => 1,
];
$result = $this->utils
->wf_civicrm_api('CustomField', 'create', $params);
$this
->assertEquals(0, $result['is_error']);
$this
->assertEquals(1, $result['count']);
$this->_customFields['text'] = $result['id'];
//Add contact reference field.
$params = [
'custom_group_id' => $this->cg['id'],
'label' => 'Participant Contact Ref',
'name' => 'participant_contact_ref',
'data_type' => 'ContactReference',
'html_type' => 'Autocomplete-Select',
'is_active' => 1,
];
$this->_customFields['participant_contact_ref'] = $this->utils
->wf_civicrm_api('CustomField', 'create', $params);
$this
->assertEquals(0, $this->_customFields['participant_contact_ref']['is_error']);
$this
->assertEquals(1, $this->_customFields['participant_contact_ref']['count']);
}