You are here

public function FunctionsTest::testFunctionWeatherGetLinkForGeoId in Weather 8

Same name and namespace in other branches
  1. 2.0.x tests/src/Functional/FunctionsTest.php \Drupal\Tests\weather\Functional\FunctionsTest::testFunctionWeatherGetLinkForGeoId()

Test _weather_get_link_for_geoid().

Throws

\ReflectionException

File

tests/src/Functional/FunctionsTest.php, line 35

Class

FunctionsTest
Tests functions of weather.module.

Namespace

Drupal\Tests\weather\Functional

Code

public function testFunctionWeatherGetLinkForGeoId() {

  // Fill database tables with test data.
  $this
    ->weatherFillWeatherSchema();

  // Test different numbers for system-wide displays.
  $link = $this
    ->weatherGetInformationAboutGeoid('geonames_2911298')['link'];
  $this
    ->assertEqual($link, 'Hamburg/Hamburg');

  // Test different numbers for yr.no links.
  $link = $this
    ->weatherGetLinkForGeoId('geonames_2911298', 'yr.no');
  $this
    ->assertEqual($link, 'http://www.yr.no/place/Germany/Hamburg/Hamburg/');
  $link = $this
    ->weatherGetLinkForGeoId('geonames_2911298', 'system-wide');
  $this
    ->assertEqual($link, 'weather/Germany/Hamburg/Hamburg/1');
  $link = $this
    ->weatherGetLinkForGeoId('geonames_2911298', 'default');
  $this
    ->assertEqual($link, 'weather/Germany/Hamburg/Hamburg');
  $link = $this
    ->weatherGetLinkForGeoId('geonames_2911298', 'user');
  $this
    ->assertEqual($link, 'weather/Germany/Hamburg/Hamburg/u');
  $link = $this
    ->weatherGetLinkForGeoId('geonames_2911298', 'yr');
  $this
    ->assertEqual($link, 'http://www.yr.no/place/Germany/Hamburg/Hamburg/forecast.xml');
}