Skip to content

Commit 724c5c0

Browse files
committed
tests: added one call resource tests
1 parent 898b88b commit 724c5c0

File tree

15 files changed

+125
-4
lines changed

15 files changed

+125
-4
lines changed

src/Entity/AirPollution/AirPollutionData.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ public function __construct(array $data)
3838
$this->ammonia = $data['components']['nh3'];
3939
}
4040

41+
/**
42+
* DateTime in UTC
43+
*/
4144
public function getDateTime(): \DateTimeImmutable
4245
{
4346
return $this->dateTime;

src/Entity/Location.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,11 +115,17 @@ public function getTimezone(): ?Timezone
115115
return $this->timezone;
116116
}
117117

118+
/**
119+
* Sunrise date in UTC
120+
*/
118121
public function getSunriseAt(): ?\DateTimeImmutable
119122
{
120123
return $this->sunriseAt;
121124
}
122125

126+
/**
127+
* Sunset date in UTC
128+
*/
123129
public function getSunsetAt(): ?\DateTimeImmutable
124130
{
125131
return $this->sunsetAt;

src/Entity/OneCall/BaseWeather.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ public function __construct(array $data)
5151
$this->snowVolume = $data['snow']['1h'] ?? $data['snow']['3h'] ?? $data['snow'] ?? null;
5252
}
5353

54+
/**
55+
* DateTime in UTC
56+
*/
5457
public function getDateTime(): \DateTimeImmutable
5558
{
5659
return $this->dateTime;

src/Entity/OneCall/DayData.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,21 +62,33 @@ public function getMoonPhase(): MoonPhase
6262
return $this->moonPhase;
6363
}
6464

65+
/**
66+
* Moonrise date in UTC
67+
*/
6568
public function getMoonriseAt(): \DateTimeImmutable
6669
{
6770
return $this->moonriseAt;
6871
}
6972

73+
/**
74+
* Moonset date in UTC
75+
*/
7076
public function getMoonsetAt(): \DateTimeImmutable
7177
{
7278
return $this->moonsetAt;
7379
}
7480

81+
/**
82+
* Sunrise date in UTC
83+
*/
7584
public function getSunriseAt(): \DateTimeImmutable
7685
{
7786
return $this->sunriseAt;
7887
}
7988

89+
/**
90+
* Sunset date in UTC
91+
*/
8092
public function getSunsetAt(): \DateTimeImmutable
8193
{
8294
return $this->sunsetAt;

src/Entity/OneCall/MinuteData.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ public function __construct(array $data)
1414
$this->precipitation = $data['precipitation'];
1515
}
1616

17+
/**
18+
* DateTime in UTC
19+
*/
1720
public function getDateTime(): \DateTimeImmutable
1821
{
1922
return $this->dateTime;

src/Entity/OneCall/WeatherData.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,17 @@ public function getVisibility(): ?int
4646
return $this->visibility;
4747
}
4848

49+
/**
50+
* Sunrise date in UTC
51+
*/
4952
public function getSunriseAt(): ?\DateTimeImmutable
5053
{
5154
return $this->sunriseAt;
5255
}
5356

57+
/**
58+
* Sunset date in UTC
59+
*/
5460
public function getSunsetAt(): ?\DateTimeImmutable
5561
{
5662
return $this->sunsetAt;

src/Entity/OneCall/WeatherSummary.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@ public function getTimezone(): Timezone
7070
return $this->timezone;
7171
}
7272

73+
/**
74+
* DateTime in UTC
75+
*/
7376
public function getDateTime(): \DateTimeImmutable
7477
{
7578
return $this->dateTime;

src/Entity/Weather/WeatherData.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,9 @@ public function __construct(array $data)
6161
$this->snowVolume = $data['snow']['1h'] ?? $data['snow']['3h'] ?? null;
6262
}
6363

64+
/**
65+
* DateTime in UTC
66+
*/
6467
public function getDateTime(): \DateTimeImmutable
6568
{
6669
return $this->dateTime;

src/Resource/AirPollutionResource.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
class AirPollutionResource extends Resource
1212
{
1313
/**
14+
* Get access to current air pollution data
15+
*
1416
* @throws ValidationException
1517
* @throws ClientExceptionInterface
1618
*/
@@ -31,6 +33,8 @@ public function getCurrent(float $latitude, float $longitude): AirPollution
3133
}
3234

3335
/**
36+
* Get access to air pollution forecast data
37+
*
3438
* @throws ValidationException
3539
* @throws ClientExceptionInterface
3640
*/
@@ -51,6 +55,8 @@ public function getForecast(float $latitude, float $longitude): AirPollutionColl
5155
}
5256

5357
/**
58+
* Get access to historical air pollution data
59+
*
5460
* @throws ValidationException
5561
* @throws ClientExceptionInterface
5662
*/

src/Resource/GeocodingResource.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ class GeocodingResource extends Resource
1616
private const NUM_RESULTS = 5;
1717

1818
/**
19+
* Get geographical coordinates (latitude, longitude) by using the name of the location (city name or area name)
20+
*
1921
* @return Location[]
2022
* @throws ValidationException
2123
* @throws ClientExceptionInterface
@@ -38,6 +40,8 @@ public function getByLocationName(string $locationName, int $numResults = self::
3840
}
3941

4042
/**
43+
* Get geographical coordinates (latitude, longitude) by using the zip/postal code
44+
*
4145
* @throws ValidationException
4246
* @throws ClientExceptionInterface
4347
*/
@@ -58,6 +62,8 @@ public function getByZipCode(string $zipCode, string $countryCode): ZipLocation
5862
}
5963

6064
/**
65+
* Get name of the location (city name or area name) by using geographical coordinates (latitude, longitude)
66+
*
6167
* @return Location[]
6268
* @throws ValidationException
6369
* @throws ClientExceptionInterface

0 commit comments

Comments
 (0)