Code Duplication    Length = 36-37 lines in 2 locations

tests/OpenWeatherMap/WeatherHistoryTest.php 2 locations

@@ 106-141 (lines=36) @@
103
        $this->assertTrue($result);
104
    }
105
106
    public function testJsonHasCountryAndPopulation()
107
    {
108
        $fakeJson = '{
109
            "cod":"200","calctime":"123456789","message":0.0032,"city_id":{"id":1851632,"name":"Shuzenji","coord":{"lon":138.933334,"lat":34.966671},"country":"JP"},
110
            "cnt":10,
111
            "list":[{
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
        $fakeJson = json_decode($fakeJson, true);
130
        $history = new WeatherHistory($fakeJson, 'Berlin');
131
132
        $history->rewind();
133
        $result = $history->valid();
134
135
        $this->assertTrue($result);
136
    }
137
138
    public function testJsonWithRainKey()
139
    {
140
        $fakeJson = '{
141
            "cod":"200","calctime":"123456789","message":0.0032,"city_id":{"id":1851632,"name":"Shuzenji","coord":{"lon":138.933334,"lat":34.966671},"country":"JP"},
142
            "cnt":10,
143
            "list":[{
144
                    "dt":1406080800,
@@ 138-174 (lines=37) @@
135
        $this->assertTrue($result);
136
    }
137
138
    public function testJsonWithRainKey()
139
    {
140
        $fakeJson = '{
141
            "cod":"200","calctime":"123456789","message":0.0032,"city_id":{"id":1851632,"name":"Shuzenji","coord":{"lon":138.933334,"lat":34.966671},"country":"JP"},
142
            "cnt":10,
143
            "list":[{
144
                    "dt":1406080800,
145
                    "temp":{
146
                        "day":297.77,
147
                        "min":293.52,
148
                        "max":297.77,
149
                        "night":293.52,
150
                        "eve":297.77,
151
                        "morn":297.77
152
                    },
153
                    "pressure":925.04,
154
                    "humidity":76,
155
                    "weather":[{"id":803,"main":"Clouds","description":"broken clouds","icon":"04d"}],
156
                    "main":{"temp":306.15,"pressure":1013,"humidity":44,"temp_min":306,"temp_max":306},
157
                    "clouds":{"all":90},
158
                    "wind":{"speed":5.71,"deg":229.501},
159
                    "rain":{"3h":3}
160
            }]
161
        }';
162
        $fakeJson = json_decode($fakeJson, true);
163
        $history = new WeatherHistory($fakeJson, 'Berlin');
164
        
165
        $history->rewind();
166
        $result = $history->valid();
167
168
        $this->assertTrue($result);
169
    }
170
}
171