You are here

public function GeolocationViewsBoundaryTest::testBoundaryLocations in Geolocation Field 8

Same name and namespace in other branches
  1. 8.3 tests/src/Functional/GeolocationViewsBoundaryTest.php \Drupal\Tests\geolocation\Functional\GeolocationViewsBoundaryTest::testBoundaryLocations()
  2. 8.2 tests/src/Functional/GeolocationViewsBoundaryTest.php \Drupal\Tests\geolocation\Functional\GeolocationViewsBoundaryTest::testBoundaryLocations()

Tests the boundary filter.

It's currently locked to filter boundary of NE80,80 to SW20,20.

File

tests/src/Functional/GeolocationViewsBoundaryTest.php, line 46

Class

GeolocationViewsBoundaryTest
Tests the grid style plugin.

Namespace

Drupal\Tests\geolocation\Functional

Code

public function testBoundaryLocations() {
  $entity_test_storage = \Drupal::entityTypeManager()
    ->getStorage('node');
  $entity_test_storage
    ->create([
    'id' => 1,
    'title' => 'Boundary 1',
    'body' => 'test test',
    'type' => 'geolocation_default_article',
    'field_geolocation_demo_single' => [
      'lat' => 52,
      'lng' => 47,
    ],
  ])
    ->save();
  $entity_test_storage
    ->create([
    'id' => 2,
    'title' => 'Boundary 2',
    'body' => 'bar test',
    'type' => 'geolocation_default_article',
    'field_geolocation_demo_single' => [
      'lat' => 53,
      'lng' => 48,
    ],
  ])
    ->save();
  $entity_test_storage
    ->create([
    'id' => 3,
    'title' => 'Boundary 3',
    'body' => 'test foobar',
    'type' => 'geolocation_default_article',
    'field_geolocation_demo_single' => [
      'lat' => 5,
      'lng' => 5,
    ],
  ])
    ->save();
  $this
    ->drupalGet($this->viewsPath);
  $this
    ->assertSession()
    ->statusCodeEquals(200);
  $this
    ->assertSession()
    ->responseContains('Boundary 1');
  $this
    ->assertSession()
    ->responseContains('Boundary 2');
  $this
    ->assertSession()
    ->responseNotContains('Boundary 3');
}