|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Cmfcmf\OpenWeatherMap\Tests; |
|
4
|
|
|
|
|
5
|
|
|
class FakeData |
|
6
|
|
|
{ |
|
7
|
|
|
const WEATHER_GROUP_JSON = '{ |
|
8
|
|
|
"list":[{ |
|
9
|
|
|
"id":1851632, |
|
10
|
|
|
"dt":1406106000, |
|
11
|
|
|
"coord":{"lon":138.933334,"lat":34.966671}, |
|
12
|
|
|
"sys":{"type":3,"id":168940,"message":0.0297,"country":"US","sunrise":1427723751,"sunset":1427768967}, |
|
13
|
|
|
"name":"Shuzenji", |
|
14
|
|
|
"main":{ |
|
15
|
|
|
"temp":298.77, |
|
16
|
|
|
"temp_min":298.77, |
|
17
|
|
|
"temp_max":298.774, |
|
18
|
|
|
"pressure":1005.93, |
|
19
|
|
|
"sea_level":1018.18, |
|
20
|
|
|
"grnd_level":1005.93, |
|
21
|
|
|
"humidity":87 |
|
22
|
|
|
}, |
|
23
|
|
|
"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}], |
|
24
|
|
|
"clouds":{"all":88}, |
|
25
|
|
|
"wind":{"speed":5.71,"deg":229.501}, |
|
26
|
|
|
"dt_txt":"2014-07-23 09:00:00" |
|
27
|
|
|
},{ |
|
28
|
|
|
"id":1851632, |
|
29
|
|
|
"dt":1406106000, |
|
30
|
|
|
"coord":{"lon":138.933334,"lat":34.966671}, |
|
31
|
|
|
"sys":{"type":3,"id":168940,"message":0.0297,"country":"US","sunrise":1427723751,"sunset":1427768967}, |
|
32
|
|
|
"name":"Shuzenji", |
|
33
|
|
|
"main":{ |
|
34
|
|
|
"temp":298.77, |
|
35
|
|
|
"temp_min":298.77, |
|
36
|
|
|
"temp_max":298.774, |
|
37
|
|
|
"pressure":1005.93, |
|
38
|
|
|
"sea_level":1018.18, |
|
39
|
|
|
"grnd_level":1005.93, |
|
40
|
|
|
"humidity":87 |
|
41
|
|
|
}, |
|
42
|
|
|
"weather":[{"id":804,"main":"Clouds","description":"overcast clouds","icon":"04d"}], |
|
43
|
|
|
"clouds":{"all":88}, |
|
44
|
|
|
"wind":{"speed":5.71,"deg":229.501}, |
|
45
|
|
|
"dt_txt":"2014-07-23 09:00:00" |
|
46
|
|
|
}] |
|
47
|
|
|
}'; |
|
48
|
|
|
|
|
49
|
|
|
public static function forecastXML() |
|
50
|
|
|
{ |
|
51
|
|
|
return '<weatherdata> |
|
52
|
|
|
<location> |
|
53
|
|
|
<name>Berlin</name> |
|
54
|
|
|
<type></type> |
|
55
|
|
|
<country>DE</country> |
|
56
|
|
|
<timezone></timezone> |
|
57
|
|
|
<location altitude="0" latitude="52.524368" longitude="13.41053" geobase="geonames" geobaseid="2950159"></location> |
|
58
|
|
|
</location> |
|
59
|
|
|
<credit></credit> |
|
60
|
|
|
<meta> |
|
61
|
|
|
<lastupdate></lastupdate> |
|
62
|
|
|
<calctime>0.0215</calctime> |
|
63
|
|
|
<nextupdate> |
|
64
|
|
|
</nextupdate> |
|
65
|
|
|
</meta> |
|
66
|
|
|
<sun rise="2016-12-28T07:17:18" set="2016-12-28T14:59:55"></sun> |
|
67
|
|
|
<forecast> |
|
68
|
|
|
<time day="2016-12-20"> |
|
69
|
|
|
<symbol number="500" name="light rain" var="10d"></symbol> |
|
70
|
|
|
<precipitation value="0.25" type="rain"></precipitation> |
|
71
|
|
|
<windDirection deg="315" code="NW" name="Northwest"></windDirection> |
|
72
|
|
|
<windSpeed mps=" 4.38" name="Gentle Breeze"></windSpeed> |
|
73
|
|
|
<temperature day="41" min="40.59" max="41" night="40.59" eve="41" morn="41"></temperature> |
|
74
|
|
|
<pressure unit="hPa" value="1048.25"></pressure> |
|
75
|
|
|
<humidity value="97" unit="%"></humidity> |
|
76
|
|
|
<clouds value="overcast clouds" all="92" unit="%"></clouds> |
|
77
|
|
|
</time> |
|
78
|
|
|
<time day="' . date('Y-m-d') . '"> |
|
79
|
|
|
<symbol number="500" name="light rain" var="10d"></symbol> |
|
80
|
|
|
<precipitation value="0.24" type="rain"></precipitation> |
|
81
|
|
|
<windDirection deg="253" code="WSW" name="West-southwest"></windDirection> |
|
82
|
|
|
<windSpeed mps="6.2" name="Moderate breeze"></windSpeed> |
|
83
|
|
|
<temperature day="40.14" min="28.96" max="40.14" night="28.96" eve="32.11" morn="39.06"></temperature> |
|
84
|
|
|
<pressure unit="hPa" value="1048.09"></pressure> |
|
85
|
|
|
<humidity value="97" unit="%"></humidity> |
|
86
|
|
|
<clouds value="clear sky" all="0" unit="%"></clouds> |
|
87
|
|
|
</time> |
|
88
|
|
|
</forecast> |
|
89
|
|
|
</weatherdata>'; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
const WEATHER_HISTORY_JSON = '{ |
|
93
|
|
|
"cod":"200","calctime":"123456789","message":0.0032,"city_id":{"id":1851632,"name":"Shuzenji","coord":{"lon":138.933334,"lat":34.966671},"country":"JP"}, |
|
94
|
|
|
"cnt":10, |
|
95
|
|
|
"list":[{ |
|
96
|
|
|
"dt":1406080800, |
|
97
|
|
|
"temp":{ |
|
98
|
|
|
"day":297.77, |
|
99
|
|
|
"min":293.52, |
|
100
|
|
|
"max":297.77, |
|
101
|
|
|
"night":293.52, |
|
102
|
|
|
"eve":297.77, |
|
103
|
|
|
"morn":297.77 |
|
104
|
|
|
}, |
|
105
|
|
|
"pressure":925.04, |
|
106
|
|
|
"humidity":76, |
|
107
|
|
|
"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}], |
|
108
|
|
|
"main":{"temp":306.15,"pressure":1013,"humidity":44,"temp_min":306,"temp_max":306}, |
|
109
|
|
|
"clouds":{"all":90}, |
|
110
|
|
|
"wind":{"speed":5.71,"deg":229.501} |
|
111
|
|
|
},{ |
|
112
|
|
|
"dt":1406080800, |
|
113
|
|
|
"temp":{ |
|
114
|
|
|
"day":297.77, |
|
115
|
|
|
"min":293.52, |
|
116
|
|
|
"max":297.77, |
|
117
|
|
|
"night":293.52, |
|
118
|
|
|
"eve":297.77, |
|
119
|
|
|
"morn":297.77 |
|
120
|
|
|
}, |
|
121
|
|
|
"pressure":925.04, |
|
122
|
|
|
"humidity":76, |
|
123
|
|
|
"weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}], |
|
124
|
|
|
"main":{"temp":306.15,"pressure":1013,"humidity":44,"temp_min":306,"temp_max":306}, |
|
125
|
|
|
"clouds":{"all":90}, |
|
126
|
|
|
"wind":{"speed":5.71,"deg":229.501} |
|
127
|
|
|
}] |
|
128
|
|
|
}'; |
|
129
|
|
|
|
|
130
|
|
|
const CURRENT_WEATHER_XML = <<<XML |
|
131
|
|
|
<current> |
|
132
|
|
|
<city id="2950159" name="Berlin"> |
|
133
|
|
|
<coord lon="13.41" lat="52.52"></coord> |
|
134
|
|
|
<country>DE</country> |
|
135
|
|
|
<sun rise="2017-01-02T07:16:51" set="2017-01-02T15:04:50"></sun> |
|
136
|
|
|
</city> |
|
137
|
|
|
<temperature value="36.48" min="35.6" max="37.4" unit="fahrenheit"></temperature> |
|
138
|
|
|
<humidity value="86" unit="%"></humidity> |
|
139
|
|
|
<pressure value="1014" unit="hPa"></pressure> |
|
140
|
|
|
<wind> |
|
141
|
|
|
<speed value="9.17" name="Fresh Breeze"></speed> |
|
142
|
|
|
<gusts></gusts> |
|
143
|
|
|
<direction value="300" code="WNW" name="West-northwest"></direction> |
|
144
|
|
|
</wind> |
|
145
|
|
|
<clouds value="75" name="broken clouds"></clouds> |
|
146
|
|
|
<visibility value="8000"></visibility> |
|
147
|
|
|
<precipitation mode="no"></precipitation> |
|
148
|
|
|
<weather number="500" value="light rain" icon="10d"></weather> |
|
149
|
|
|
<lastupdate value="2017-01-02T12:20:00"></lastupdate> |
|
150
|
|
|
</current> |
|
151
|
|
|
XML; |
|
152
|
|
|
} |
|
153
|
|
|
|