View source
<?php
require_once drupal_get_path('module', 'location') . '/tests/location_testcase.test';
require_once drupal_get_path('module', 'location') . '/tests/geocoder_api_keys.inc';
class LocationGoogleGeocoderTest extends LocationTestCase {
public static function getInfo() {
return array(
'name' => t('Location Google Geocoder tests(broken!!!)'),
'description' => t('Test address mangling for the google geocoder.'),
'group' => t('Location', array(), array(
'context' => 'geolocation',
)),
);
}
public function setUp() {
parent::setUp('location', 'location_node', 'devel');
variable_set('location_geocode_google_apikey', TESTING_APIKEY_GOOGLE_MAPS);
$web_admin = $this
->drupalCreateUser(array_keys(module_invoke_all('permission')));
$this
->drupalLogin($web_admin);
}
public function testUSA() {
$settings = array(
'location_geocode_us' => 'google',
);
$this
->drupalPost('admin/config/content/location/geocoding', $settings, 'Save configuration');
$this
->refreshVariables();
$settings = array();
$location_type = $this
->addLocationContentType($settings);
$location1_name = $this
->randomName();
$node = $this
->drupalCreateNode(array(
'type' => $location_type,
'locations' => array(
0 => array(
'name' => $location1_name,
'location_settings' => $settings,
'street' => '1600 Amphitheatre Parkway',
'city' => 'Mountain View',
'province' => 'CA',
'postal_code' => '94043',
'country' => 'us',
),
),
));
$node2 = node_load($node->nid, NULL, TRUE);
$location = $node2->locations[0];
$this
->pass('<pre>' . print_r($node2, TRUE) . '</pre>', 'Debug');
$expected = array(
37.421972,
-122.084143,
);
$result = array(
$location['latitude'],
$location['longitude'],
);
}
}