public function CCKFeedsMapperLocationTestCase::setUp in Location Feeds 7
Same name and namespace in other branches
- 6 tests/location_feeds.cck.test \CCKFeedsMapperLocationTestCase::setUp()
Set up the test.
File
- tests/
location_feeds.cck.test, line 26
Class
Code
public function setUp() {
// Call parent setup with required modules.
parent::setUp(array(
'location',
'location_feeds',
'cck',
'location_cck',
));
// Create user and login.
$this
->drupalLogin($this
->drupalCreateUser(array(
'administer content types',
'administer feeds',
'administer nodes',
'administer site configuration',
)));
$settings = LocationTestCase::getLocationFieldDefaults();
// unset stuff CCK doesn't need
unset($settings['location_settings']['multiple']);
unset($settings['location_settings']['rss']);
// Create content type.
$type = $this
->drupalCreateContentType($settings);
$this->type = $type->type;
$fields = array(
'field_location' => array(
'field_name' => 'field_location',
'type' => 'location',
'label' => 'field_location_location_label',
'widget' => 'location',
'settings' => array(
'location_settings' => array(
'form' => array(
'fields' => $settings,
),
),
),
),
);
foreach ($fields as $field) {
$f = array(
'field_name' => $field['field_name'],
'type' => $field['type'],
);
field_create_field($f);
$i = array(
'field_name' => $field['field_name'],
'entity_type' => 'node',
'label' => $field['label'],
'bundle' => $this->type,
'settings' => isset($field['settings']) ? $field['settings'] : array(),
'widget' => array(
'type' => $field['widget'],
),
);
field_create_instance($i);
}
}