Add tests for 0 results METAR

This commit is contained in:
Nabeel Shahzad 2021-04-14 06:45:35 -04:00
parent f5e83461a3
commit d18925f473
2 changed files with 20 additions and 0 deletions

View File

@ -247,4 +247,15 @@ class MetarTest extends TestCase
$metar = $airportSvc->getMetar('7AK4');
$this->assertNull($metar);
}
public function testHttpCallNoResults()
{
$this->mockXmlResponse('aviationweather/no_results.xml');
/** @var AirportService $airportSvc */
$airportSvc = app(AirportService::class);
$metar = $airportSvc->getMetar('AYMR');
$this->assertNull($metar);
}
}

View File

@ -0,0 +1,9 @@
<response xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.2" xsi:noNamespaceSchemaLocation="http://www.aviationweather.gov/static/adds/schema/metar1_2.xsd">
<request_index>414399629</request_index>
<data_source name="metars"/>
<request type="retrieve"/>
<errors/>
<warnings/>
<time_taken_ms>5</time_taken_ms>
<data num_results="0"/>
</response>