feat: auto-booking services
addresses #869cfcptv
This commit is contained in:
@@ -32,7 +32,7 @@ class TravelParserTest extends TestCase
|
||||
<preis>0,00</preis>
|
||||
<status>Frei</status>
|
||||
</leistung>
|
||||
<leistung id="2" idbuspro="183659" unterart="SON" termin="01.01.2030" bis="06.01.2030" automatisch_buchen="False" pflicht="False">
|
||||
<leistung id="2" idbuspro="183659" unterart="SON" termin="01.01.2030" bis="06.01.2030" automatisch_buchen="True" pflicht="False">
|
||||
<text>Bettwäsche-Set inkl. Handtuch</text>
|
||||
<hinweis>Das Bettwäsche-Set umfasst Spannbettlaken, Kissen- und Deckenbezug. Beim Handtuch handelt es sich um ein Duschtuch (ca. 70x140cm).</hinweis>
|
||||
<preis>13,90</preis>
|
||||
@@ -92,6 +92,7 @@ class TravelParserTest extends TestCase
|
||||
'Das Bettwäsche-Set umfasst Spannbettlaken, Kissen- und Deckenbezug. Beim Handtuch handelt es sich um ein Duschtuch (ca. 70x140cm).',
|
||||
$bettwascheService->description
|
||||
);
|
||||
$this->assertTrue($bettwascheService->autoBook);
|
||||
|
||||
// Service without description (ID 183656 - Skipass, has hinweis_stamm but no hinweis)
|
||||
$this->assertArrayHasKey(183656, $additionalServices);
|
||||
@@ -112,6 +113,7 @@ class TravelParserTest extends TestCase
|
||||
$busService = $transportationServices[183649];
|
||||
$this->assertSame('Bus-Hinfahrt', $busService->label);
|
||||
$this->assertSame('Bus fährt nur bei ausreichender Teilnehmerzahl', $busService->description);
|
||||
$this->assertFalse($busService->autoBook);
|
||||
}
|
||||
|
||||
public function testParseServiceWithoutDescriptions(): void
|
||||
@@ -149,6 +151,39 @@ class TravelParserTest extends TestCase
|
||||
$this->assertNull($service->description); // No hinweis node should result in null description
|
||||
}
|
||||
|
||||
public function testParseServiceWithLowerCaseAutoBookFlag(): 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="183660" unterart="VPF" automatisch_buchen="true" pflicht="False">
|
||||
<text>Service with auto-book</text>
|
||||
<preis>8,90</preis>
|
||||
<status>Frei</status>
|
||||
</leistung>
|
||||
</lei_sonstiges>
|
||||
<hotel id="1" idbuspro="157047">
|
||||
<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(183660, $additionalServices);
|
||||
$this->assertTrue($additionalServices[183660]->autoBook);
|
||||
}
|
||||
|
||||
public function testParseServiceWithEmptyDescription(): void
|
||||
{
|
||||
$xmlContent = '<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
Reference in New Issue
Block a user