public function GeolocationGeometryViewsBoundaryTest::testBoundaryLocations in Geolocation Field 8.3
Tests the boundary filter.
It's currently locked to filter boundary of NE80,80 to SW20,20.
File
- modules/
geolocation_geometry/ tests/ src/ Functional/ GeolocationGeometryViewsBoundaryTest.php, line 69
Class
- GeolocationGeometryViewsBoundaryTest
- Tests the grid style plugin.
Namespace
Drupal\Tests\geolocation_geometry\FunctionalCode
public function testBoundaryLocations() {
$entity_test_storage = \Drupal::entityTypeManager()
->getStorage('node');
$entity_test_storage
->create([
'id' => 1,
'title' => 'Containing Polygon',
'body' => 'test test',
'type' => 'geolocation_geometry_demo',
'field_geolocation_geometry_polyg' => [
'wkt' => 'POLYGON((170 -44, 169 -44, 169 -45, 170 -45, 170 -44))',
],
])
->save();
$entity_test_storage
->create([
'id' => 2,
'title' => 'Intersecting Polygon',
'body' => 'test foobar',
'type' => 'geolocation_geometry_demo',
'field_geolocation_geometry_polyg' => [
'wkt' => 'POLYGON((171.1217044 -43.6891741, 168.1217044 -43.6891741, 168.1217044 -45.6891741, 171.1217044 -45.6891741, 171.1217044 -43.6891741))',
],
])
->save();
$entity_test_storage
->create([
'id' => 3,
'title' => 'Outside Polygon',
'body' => 'test foobar',
'type' => 'geolocation_geometry_demo',
'field_geolocation_geometry_polyg' => [
'wkt' => 'POLYGON((10 20, 8 20, 8 22, 10 22, 10 20))',
],
])
->save();
$this
->drupalGet($this->viewsPath);
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->responseContains('Wanaka');
$this
->assertSession()
->responseContains('Containing Polygon');
$this
->assertSession()
->responseNotContains('Intersecting Polygon');
$this
->assertSession()
->responseNotContains('Outside Polygon');
}