public function GeolocationViewsProximityArgumentTest::testNoProximityLocations in Geolocation Field 8
Same name and namespace in other branches
- 8.3 tests/src/Functional/GeolocationViewsProximityArgumentTest.php \Drupal\Tests\geolocation\Functional\GeolocationViewsProximityArgumentTest::testNoProximityLocations()
- 8.2 tests/src/Functional/GeolocationViewsProximityArgumentTest.php \Drupal\Tests\geolocation\Functional\GeolocationViewsProximityArgumentTest::testNoProximityLocations()
Tests the CommonMap style.
File
- tests/
src/ Functional/ GeolocationViewsProximityArgumentTest.php, line 44
Class
- GeolocationViewsProximityArgumentTest
- Tests the grid style plugin.
Namespace
Drupal\Tests\geolocation\FunctionalCode
public function testNoProximityLocations() {
$entity_test_storage = \Drupal::entityTypeManager()
->getStorage('node');
$entity_test_storage
->create([
'id' => 1,
'title' => 'Proximity 1',
'body' => 'test test',
'type' => 'geolocation_default_article',
'field_geolocation_demo_single' => [
'lat' => 52,
'lng' => 47,
],
])
->save();
$entity_test_storage
->create([
'id' => 2,
'title' => 'Proximity 2',
'body' => 'bar test',
'type' => 'geolocation_default_article',
'field_geolocation_demo_single' => [
'lat' => 53,
'lng' => 48,
],
])
->save();
$entity_test_storage
->create([
'id' => 3,
'title' => 'Proximity 3',
'body' => 'test foobar',
'type' => 'geolocation_default_article',
'field_geolocation_demo_single' => [
'lat' => 54,
'lng' => 49,
],
])
->save();
$this
->drupalGet($this->viewsPath);
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->responseNotContains('Proximity 1');
$this
->assertSession()
->responseNotContains('Proximity 2');
$this
->assertSession()
->responseNotContains('Proximity 3');
$this
->drupalGet($this->viewsPath . '/52,47<=1miles');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->responseContains('Proximity 1');
$this
->assertSession()
->responseNotContains('Proximity 2');
$this
->assertSession()
->responseNotContains('Proximity 3');
$this
->drupalGet($this->viewsPath . '/52,47<=140');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->responseContains('Proximity 1');
$this
->assertSession()
->responseContains('Proximity 2');
$this
->assertSession()
->responseNotContains('Proximity 3');
$this
->drupalGet($this->viewsPath . '/52,47>140');
$this
->assertSession()
->statusCodeEquals(200);
$this
->assertSession()
->responseNotContains('Proximity 1');
$this
->assertSession()
->responseNotContains('Proximity 2');
$this
->assertSession()
->responseContains('Proximity 3');
}