You are here

public function WeatherCommonTestTrait::weatherGetInformationAboutGeoid in Weather 2.0.x

Same name and namespace in other branches
  1. 8 tests/src/Functional/WeatherCommonTestTrait.php \Drupal\Tests\weather\Functional\WeatherCommonTestTrait::weatherGetInformationAboutGeoid()

Get information about a GeoID.

Parameters

string $wanted_geoid: GeoID.

Return value

object The information about the GeoID or FALSE.

2 calls to WeatherCommonTestTrait::weatherGetInformationAboutGeoid()
ParserTest::weatherUpdatePlaces in tests/src/Functional/ParserTest.php
Handle updates to the weather_places table.
WeatherCommonTestTrait::weatherGetLinkForGeoId in tests/src/Functional/WeatherCommonTestTrait.php
Construct the link for the given GeoID.

File

tests/src/Functional/WeatherCommonTestTrait.php, line 160

Class

WeatherCommonTestTrait
Provides a helper method for testing Weather module.

Namespace

Drupal\Tests\weather\Functional

Code

public function weatherGetInformationAboutGeoid($wanted_geoid) {
  $connection = \Drupal::database();
  $query = $connection
    ->select('weather_place', 'wfi');
  $query
    ->condition('wfi.geoid', $wanted_geoid, '=');
  $query
    ->fields('wfi', [
    'geoid',
    'link',
    'country',
  ]);
  $query
    ->range(0, 50);
  $result = $query
    ->execute();
  return $result
    ->fetchAssoc();
}