@@ -21,8 +21,8 @@ public function testHydratesCapturedCurrentWeather(): void
2121 Fixture::json ('weather/current/success.json ' ),
2222 );
2323
24- self ::assertSame (38.7223 , $ weather ->latitude ());
25- self ::assertSame (-9.1393 , $ weather ->longitude ());
24+ self ::assertSame (38.7223 , $ weather ->coordinates ()?-> latitude());
25+ self ::assertSame (-9.1393 , $ weather ->coordinates ()?-> longitude());
2626 self ::assertSame (22.55 , $ weather ->temperature ());
2727 self ::assertSame (Unit::CELSIUS , $ weather ->temperatureUnit ());
2828 self ::assertSame ('22.55 °C ' , $ weather ->temperatureWithUnit ());
@@ -124,6 +124,7 @@ public function testRetainsUnitsFromHydrationContext(): void
124124
125125 public function testToleratesMissingNullUnknownAndPartialFields (): void
126126 {
127+ self ::assertNull (Current::fromArray ([])->coordinates ());
127128 self ::assertSame ([], Current::fromArray (['weather ' => null ])->conditions ());
128129
129130 $ weather = Current::fromArray ([
@@ -142,8 +143,8 @@ public function testToleratesMissingNullUnknownAndPartialFields(): void
142143 'unknown ' => new \stdClass (),
143144 ]);
144145
145- self ::assertNull ($ weather ->latitude ());
146- self ::assertNull ($ weather ->longitude ());
146+ self ::assertNull ($ weather ->coordinates ()?-> latitude());
147+ self ::assertNull ($ weather ->coordinates ()?-> longitude());
147148 self ::assertCount (1 , $ weather ->conditions ());
148149 self ::assertNull ($ weather ->conditions ()[0 ]->icon ());
149150 self ::assertNull ($ weather ->conditions ()[0 ]->iconUrl ());
@@ -185,7 +186,7 @@ public function testRejectsInvalidKnownFieldTypes(
185186 public static function invalidFields (): iterable
186187 {
187188 yield 'coordinates ' => [['coord ' => 'invalid ' ], 'coord ' , 'array ' , 'string ' ];
188- yield 'latitude ' => [['coord ' => ['lat ' => '38.7 ' ]], 'coord. lat ' , 'int|float ' , 'string ' ];
189+ yield 'latitude ' => [['coord ' => ['lat ' => '38.7 ' ]], 'lat ' , 'int|float ' , 'string ' ];
189190 yield 'conditions ' => [['weather ' => 'Clouds ' ], 'weather ' , 'array ' , 'string ' ];
190191 yield 'condition member ' => [['weather ' => ['Clouds ' ]], 'weather.0 ' , 'array ' , 'string ' ];
191192 yield 'condition id ' => [['weather ' => [['id ' => '802 ' ]]], 'id ' , 'int ' , 'string ' ];
0 commit comments