File tree Expand file tree Collapse file tree 2 files changed +10
-6
lines changed
tests/Geocoder/Tests/Provider Expand file tree Collapse file tree 2 files changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -80,13 +80,21 @@ private function executeQuery($query)
80
80
81
81
$ data = array_filter ($ json );
82
82
83
+ $ admins = [];
84
+
85
+ $ region = \igorw \get_in ($ data , ['geoplugin_regionName ' ]);
86
+ $ regionCode = \igorw \get_in ($ data , ['geoplugin_regionCode ' ]);
87
+
88
+ if (null !== $ region || null !== $ regionCode ) {
89
+ $ admins [0 ] = ['name ' => $ region , 'code ' => $ regionCode ];
90
+ }
91
+
83
92
$ results = [];
84
93
$ results [] = array_merge ($ this ->getDefaults (), [
85
94
'locality ' => isset ($ data ['geoplugin_city ' ]) ? $ data ['geoplugin_city ' ] : null ,
86
95
'country ' => isset ($ data ['geoplugin_countryName ' ]) ? $ data ['geoplugin_countryName ' ] : null ,
87
96
'countryCode ' => isset ($ data ['geoplugin_countryCode ' ]) ? $ data ['geoplugin_countryCode ' ] : null ,
88
- 'region ' => isset ($ data ['geoplugin_regionName ' ]) ? $ data ['geoplugin_regionName ' ] : null ,
89
- 'regionCode ' => isset ($ data ['geoplugin_regionCode ' ]) ? $ data ['geoplugin_regionCode ' ] : null ,
97
+ 'admins ' => $ admins ,
90
98
'latitude ' => isset ($ data ['geoplugin_latitude ' ]) ? $ data ['geoplugin_latitude ' ] : null ,
91
99
'longitude ' => isset ($ data ['geoplugin_longitude ' ]) ? $ data ['geoplugin_longitude ' ] : null ,
92
100
]);
Original file line number Diff line number Diff line change @@ -53,8 +53,6 @@ public function testGeocodeWithLocalhostIPv4()
53
53
54
54
$ result = $ results ->first ();
55
55
$ this ->assertEquals ('localhost ' , $ result ->getLocality ());
56
- $ this ->assertEquals ('localhost ' , $ result ->getAdmins ()[1 ]->getName ());
57
- $ this ->assertEquals ('localhost ' , $ result ->getAdmins ()[0 ]->getName ());
58
56
$ this ->assertEquals ('localhost ' , $ result ->getCountry ()->getName ());
59
57
}
60
58
6D8C
@@ -68,8 +66,6 @@ public function testGeocodeWithLocalhostIPv6()
68
66
69
67
$ result = $ results ->first ();
70
68
$ this ->assertEquals ('localhost ' , $ result ->getLocality ());
71
- $ this ->assertEquals ('localhost ' , $ result ->getAdmins ()[1 ]->getName ());
72
- $ this ->assertEquals ('localhost ' , $ result ->getAdmins ()[0 ]->getName ());
73
69
$ this ->assertEquals ('localhost ' , $ result ->getCountry ()->getName ());
74
70
}
75
71
You can’t perform that action at this time.
0 commit comments