You are here

public function GeolocationFieldTest::xxtestGeolocationFieldGeocoderWidgetEmptyRequired in Geolocation Field 8

Helper function for testGeolocationField().

File

tests/src/Functional/GeolocationFieldTest.php, line 101

Class

GeolocationFieldTest
Tests the creation of geolocation fields.

Namespace

Drupal\Tests\geolocation\Functional

Code

public function xxtestGeolocationFieldGeocoderWidgetEmptyRequired() {
  EntityFormDisplay::load('node.geolocation_default_article.default')
    ->setComponent('field_geolocation_demo_single', [
    'type' => 'geolocation_googlegeocoder',
  ])
    ->save();
  EntityViewDisplay::load('node.geolocation_default_article.default')
    ->setComponent('field_geolocation_demo_single', [
    'type' => 'geolocation_latlng',
    'weight' => 1,
  ])
    ->save();

  // Display creation form.
  $this
    ->drupalGet('node/add/geolocation_default_article');
  $this
    ->assertSession()
    ->fieldExists("field_geolocation_demo_single[0][lat]");
  $this
    ->assertSession()
    ->fieldExists("field_geolocation_demo_single[0][lng]");
  $edit = [
    'title[0][value]' => $this
      ->randomMachineName(),
  ];
  $this
    ->drupalPostForm(NULL, $edit, t('Save'));
  $this
    ->assertSession()
    ->pageTextContains('No location has been selected yet for required field Geolocation');
}