You are here

function LocationTestCase::addLocationContentType in Location 7.4

Same name and namespace in other branches
  1. 6.3 tests/location_testcase.php \LocationTestCase::addLocationContentType()
  2. 7.5 tests/location_testcase.php \LocationTestCase::addLocationContentType()
  3. 7.3 tests/location_testcase.test \LocationTestCase::addLocationContentType()
6 calls to LocationTestCase::addLocationContentType()
CowInstanceTest::testCOWConservation in tests/cow.test
CowInstanceTest::testLocpickOnly in tests/cow.test
CowInstanceTest::testMultipleLocationOnSingleNode in tests/cow.test
CowInstanceTest::testNodeRevisionCOW in tests/cow.test
CowInstanceTest::testSharedLocation in tests/cow.test

... See full list

1 method overrides LocationTestCase::addLocationContentType()
LocationCCKTest::addLocationContentType in tests/location_cck.test

File

tests/location_testcase.php, line 98
Common functions for Location tests.

Class

LocationTestCase

Code

function addLocationContentType(&$settings, $add = array()) {

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

  // Get the (settable) defaults.
  $defaults = $this
    ->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);
  $this
    ->flattenPostData($settings);
  $add = array(
    'location_settings' => $add,
  );
  $this
    ->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;
}