You are here

public function ExifFunctionalTestCase::addExistingFieldToContentType in Exif 7

1 call to ExifFunctionalTestCase::addExistingFieldToContentType()
ExifFunctionalTestCase::setUp in ./exif_functionaltests.php
Sets up a Drupal site for running functional and integration tests.

File

./exif_functionaltests.php, line 84

Class

ExifFunctionalTestCase

Code

public function addExistingFieldToContentType($contenttype, $fieldLabel, $fieldName, $fieldWidget, $fieldSettings = array()) {
  $edit = array();
  $edit["fields[_add_existing_field][label]"] = $fieldLabel;
  $edit["fields[_add_existing_field][field_name]"] = 'field_' . $fieldName;
  $edit["fields[_add_existing_field][widget_type]"] = $fieldWidget;
  $this
    ->drupalPost("admin/structure/types/manage/{$contenttype->type}/fields", $edit, t("Save"));
  $this
    ->drupalPost(NULL, $fieldSettings, "Save settings");
}