function GeofieldFormatterTestCase::testGeofieldWKTFormatter in Geofield 7.2
File
- tests/
geofield.test, line 298 - Tests for geofield.module.
Class
Code
function testGeofieldWKTFormatter() {
// Test lat/lon widget
$this
->_testGeoFieldAPISetup('geofield_wkt', 'geofield_wkt');
// Display creation form.
$langcode = LANGUAGE_NONE;
$this
->drupalGet('test-entity/add/test-bundle');
// Submit with some value.
include_once drupal_get_path('module', 'geofield') . '/includes/GeoGenerator.php';
$generator = new GeoGenerator();
$wkt = $generator
->wkt_generate();
geophp_load();
$geometry = geoPHP::load($wkt, 'wkt');
$edit = array(
"{$this->field_name}[{$langcode}][0][geom]" => $geometry
->out('wkt'),
);
$this
->drupalPost(NULL, $edit, t('Save'));
preg_match('|test-entity/manage/(\\d+)/edit|', $this->url, $match);
$id = $match[1];
$this
->_testWKTFormatter($id, $geometry, 'wkt');
}