You are here

protected function LocationCCKTest::addLocationContentType in Location 7.3

Same name and namespace in other branches
  1. 6.3 tests/location_cck.test \LocationCCKTest::addLocationContentType()
  2. 7.5 tests/location_cck.test \LocationCCKTest::addLocationContentType()
  3. 7.4 tests/location_cck.test \LocationCCKTest::addLocationContentType()

Parameters

$settings:

array $add:

Return value

string

Overrides LocationTestCase::addLocationContentType

See also

addLocationContentType2()

File

tests/location_cck.test, line 51

Class

LocationCCKTest
Class LocationCCKTest.

Code

protected function addLocationContentType(&$settings, $add = array()) {
  $field_name = 'loctest';

  // Let the caller mess with some relevant cck stuff.
  $required = isset($add['cck_required']) ? $add['cck_required'] : FALSE;
  $multiple = isset($add['cck_multiple']) ? $add['cck_multiple'] : 0;
  unset($add['cck_required']);
  unset($add['cck_multiple']);

  // find a non-existent random type name.
  $name = strtolower($this
    ->randomName(8));
  $form = array(
    'name' => $name,
    'type' => $name,
  );
  $this
    ->flattenPostData($form);
  $this
    ->drupalPost('admin/structure/types/add', $form, 'Save content type');
  $this
    ->refreshVariables();
  $form = array(
    'fields[_add_new_field][label]' => 'Location',
    'fields[_add_new_field][field_name]' => $field_name,
    'fields[_add_new_field][type]' => 'location',
    'fields[_add_new_field][widget_type]' => 'location',
  );
  $this
    ->drupalPost('admin/structure/types/manage/' . $name . '/fields', $form, 'Save');
  $this
    ->refreshVariables();
  drupal_get_schema(NULL, TRUE);
  $form = array();
  $this
    ->drupalPost(NULL, $form, 'Save field settings');
  return $name;
}