fix: XML scope for services too broad
This commit is contained in:
@@ -184,6 +184,47 @@ class TravelParserTest extends TestCase
|
||||
$this->assertTrue($additionalServices[183660]->autoBook);
|
||||
}
|
||||
|
||||
public function testParseAdditionalServicesUsesTerminLevelOnly(): void
|
||||
{
|
||||
$xmlContent = '<?xml version="1.0" encoding="utf-8"?>
|
||||
<reisen>
|
||||
<reise id="1" idbuspro="2187" code="SSTMR">
|
||||
<termin id="1" idbuspro="11946" termin="01.01.2030" bis="06.01.2030" reiseart="F">
|
||||
<text>Test Travel</text>
|
||||
<abpreis>659,00</abpreis>
|
||||
<lei_sonstiges>
|
||||
<leistung id="1" idbuspro="183656" unterart="SPA" automatisch_buchen="True" pflicht="False">
|
||||
<text>Skipass 6 Tage</text>
|
||||
<preis>59,00</preis>
|
||||
<status>Frei</status>
|
||||
</leistung>
|
||||
</lei_sonstiges>
|
||||
<hotel id="1" idbuspro="157047">
|
||||
<lei_sonstiges>
|
||||
<leistung id="1" idbuspro="183656" unterart="SPA" automatisch_buchen="False" pflicht="False">
|
||||
<text>Skipass 6 Tage Hotel</text>
|
||||
<preis>59,00</preis>
|
||||
<status>Frei</status>
|
||||
</leistung>
|
||||
</lei_sonstiges>
|
||||
<zimmer>
|
||||
<preis zimmercode="4erDW" idbuspro_zimmer="95" zimmertext="4er Zimmer" MinPax="4" MaxPax="4" naechte="5" preis="689,00" status="Frei" verfuegbar="8" />
|
||||
</zimmer>
|
||||
</hotel>
|
||||
</termin>
|
||||
</reise>
|
||||
</reisen>';
|
||||
|
||||
$crawler = new Crawler($xmlContent);
|
||||
$travelNode = $crawler->filterXPath('//reise/termin')->first();
|
||||
$travel = $this->parser->parse($travelNode);
|
||||
|
||||
$additionalServices = $travel->additionalServices;
|
||||
$this->assertArrayHasKey(183656, $additionalServices);
|
||||
$this->assertTrue($additionalServices[183656]->autoBook);
|
||||
$this->assertSame('Skipass 6 Tage', $additionalServices[183656]->label);
|
||||
}
|
||||
|
||||
public function testParseServiceWithEmptyDescription(): void
|
||||
{
|
||||
$xmlContent = '<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
Reference in New Issue
Block a user