@@ -117,6 +117,7 @@ public function testParseInvalid()
117117 {
118118 // launch decoding
119119 $ d = $ this ->decoder ->parseNotStrict ('METAR LFPB 190730Z AUTOPP 17005KT 6000 OVC024 02/00 Q10032 ' );
120+ // here ^ ^ and here
120121
121122 // compare results
122123 $ this ->assertFalse ($ d ->isValid ());
@@ -139,6 +140,36 @@ public function testParseInvalid()
139140 $ this ->assertEquals (2 , $ d ->getAirTemperature ()->getValue ());
140141 $ this ->assertEquals (0 , $ d ->getDewPointTemperature ()->getValue ());
141142 $ this ->assertNull ($ d ->getPressure ());
143+
144+ }
145+
146+ /**
147+ * Test parsing of an invalid METAR, where parsing can continue normally without strict option activated
148+ */
149+ public function testParseInvalidPart ()
150+ {
151+ // launch decoding
152+ $ d = $ this ->decoder ->parseNotStrict ('METAR LFPB 190730Z AUTOP X17005KT 6000 OVC024 02/00 Q1032 ' );
153+ // here ^ ^ and here
154+
155+ // compare results
156+ $ this ->assertFalse ($ d ->isValid ());
157+ $ this ->assertEquals (2 , count ($ d ->getDecodingExceptions ()));
158+ $ this ->assertEquals ('METAR ' , $ d ->getType ());
159+ $ this ->assertEquals ('LFPB ' , $ d ->getIcao ());
160+ $ this ->assertEquals (19 , $ d ->getDay ());
161+ $ this ->assertEquals ('07:30 UTC ' , $ d ->getTime ());
162+ $ this ->assertNull ($ d ->getStatus ());
163+ $ this ->assertNull ($ d ->getSurfaceWind ());
164+ $ v = $ d ->getVisibility ();
165+ $ this ->assertEquals (6000 , $ v ->getVisibility ()->getValue ());
166+ $ cs = $ d ->getClouds ();
167+ $ c = $ cs [0 ];
168+ $ this ->assertEquals ('OVC ' , $ c ->getAmount ());
169+ $ this ->assertEquals (2400 , $ c ->getBaseHeight ()->getValue ());
170+ $ this ->assertEquals (2 , $ d ->getAirTemperature ()->getValue ());
171+ $ this ->assertEquals (0 , $ d ->getDewPointTemperature ()->getValue ());
172+ $ this ->assertEquals (1032 , $ d ->getPressure ()->getValue ());
142173 }
143174
144175 /**
0 commit comments