| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667 | <?php/** * @file * Tests for geofield.module. */class GeoFieldTestCase extends DrupalWebTestCase {  public static function getInfo() {    return array(      'name'  => 'Geofield',      'description'  => "Test the creation of geofields.",      'group' => 'Field types'    );  }  function setUp() {    parent::setUp(array('geofield', 'field_test'));    $this->admin_user = $this->drupalCreateUser(array('administer filters'));    $this->web_user = $this->drupalCreateUser(array('access field_test content', 'administer field_test content', 'administer modules'));    $this->drupalLogin($this->web_user);  }  // Test fields.    /**   * Test widgets.   */  function testGeofieldWidgets() {    $this->_testGeofieldWidgets('geofield_wkt');  }  /**   * Helper function for testGeofieldWidgets().   */  function _testGeofieldWidgets($widget_type) {    // Setup a field and instance    $entity_type = 'test_entity';    $this->field_name = drupal_strtolower($this->randomName());    $this->field = array('field_name' => $this->field_name, 'type' => 'geofield');    field_create_field($this->field);    $this->instance = array(      'field_name' => $this->field_name,      'entity_type' => 'test_entity',      'bundle' => 'test_bundle',      'label' => $this->randomName() . '_label',      'settings' => array(      ),      'widget' => array(        'type' => $widget_type,      ),      'display' => array(        'full' => array(          'type' => 'geofield_wkt',        ),      ),    );    field_create_instance($this->instance);    $langcode = LANGUAGE_NONE;    // Display creation form.    $this->drupalGet('test-entity/add/test-bundle');    $this->assertFieldByName("{$this->field_name}[$langcode][0][wkt]", '', t('Widget is displayed'));  }}
 |