You are here

public function FeedsMapperLocationTestCase::createLocationType in Location Feeds 6

Same name and namespace in other branches
  1. 7 tests/location_feeds.test.inc \FeedsMapperLocationTestCase::createLocationType()
3 calls to FeedsMapperLocationTestCase::createLocationType()
DMSFeedsMapperLocationTestCase::test in tests/location_feeds.dms.test
Basic test loading an RSS feed for nodes with locations.
GeoRSSFeedsMapperLocationTestCase::test in tests/location_feeds.georss.test
Basic test loading an RSS feed for nodes with locations.
NodeFeedsMapperLocationTestCase::test in tests/location_feeds.node.test
Basic test loading an RSS feed for nodes with locations.

File

tests/location_feeds.test.inc, line 19

Class

FeedsMapperLocationTestCase
Class for testing Feeds <em>location</em> mapper.

Code

public function createLocationType(&$settings, $add = array()) {

  // find a non-existent random type name.
  do {
    $name = strtolower($this
      ->randomName(3, 'type_'));
  } while (node_get_types('type', $name));

  // Get the (settable) defaults.
  $defaults = LocationTestCase::getLocationFieldDefaults();
  $settings = array(
    'name' => $name,
    'type' => $name,
    'location_settings' => array(
      'multiple' => array(
        'max' => 1,
        'add' => 1,
      ),
      'form' => array(
        'fields' => $defaults,
      ),
    ),
  );

  //$settings['location_settings'] = array_merge_recursive($settings['location_settings'], $add);
  LocationTestCase::flattenPostData($settings);
  $add = array(
    'location_settings' => $add,
  );
  LocationTestCase::flattenPostData($add);
  $settings = array_merge($settings, $add);
  $this
    ->drupalPost('admin/content/types/add', $settings, 'Save content type');
  $this
    ->refreshVariables();
  $settings = variable_get('location_settings_node_' . $name, array());
  return $name;
}