FunctionsTest.php in Weather 2.0.x
File
tests/src/Functional/FunctionsTest.php
View source
<?php
namespace Drupal\Tests\weather\Functional;
use Drupal\Tests\BrowserTestBase;
class FunctionsTest extends BrowserTestBase {
use WeatherCommonTestTrait;
protected static $modules = [
'weather',
];
protected $defaultTheme = 'stark';
public function testFunctionWeatherGetLinkForGeoId() {
$this
->weatherFillWeatherSchema();
$link = $this
->weatherGetInformationAboutGeoid('geonames_2911298')['link'];
$this
->assertEquals('Hamburg/Hamburg', $link);
$link = $this
->weatherGetLinkForGeoId('geonames_2911298', 'yr.no');
$this
->assertEquals('https://www.yr.no/place/Germany/Hamburg/Hamburg/', $link);
$link = $this
->weatherGetLinkForGeoId('geonames_2911298', 'system-wide');
$this
->assertEquals('weather/Germany/Hamburg/Hamburg/1', $link);
$link = $this
->weatherGetLinkForGeoId('geonames_2911298', 'default');
$this
->assertEquals('weather/Germany/Hamburg/Hamburg', $link);
$link = $this
->weatherGetLinkForGeoId('geonames_2911298', 'user');
$this
->assertEquals('weather/Germany/Hamburg/Hamburg/u', $link);
$link = $this
->weatherGetLinkForGeoId('geonames_2911298', 'yr');
$this
->assertEquals('https://www.yr.no/place/Germany/Hamburg/Hamburg/forecast.xml', $link);
}
}