chore: remove boarding point price levelling
This commit is contained in:
1 parent
3f941bb4bf
commit
57b86a8fbc
10 files changed
+23
-144
No files matched your search
@@ -357,49 +357,23 @@ class TravelParserTest extends TestCase
|
||||
$this->assertNull($travel->status); // No status_hin node should result in null
|
||||
}
|
||||
|
||||
public function testDropOffsInheritThePickupPriceWhenTheReturnLegStatesNone(): void
|
||||
public function testBoardingPricesAreReportedVerbatimPerLeg(): void
|
||||
{
|
||||
// Shape of product 701: the return boarding points carry no preis although
|
||||
// BusPro bills an Abfahrtsortzuschlag for the return leg as well.
|
||||
// BusPro bills the return-leg Abfahrtsortzuschlag only where the return entry
|
||||
// states a preis, so an unpriced return leg is free and each leg keeps its own price.
|
||||
$travel = $this->parseTravelWithBoardingPoints(
|
||||
'<zustieg idbuspro="18" zeit="12.12.2026 21:45:00" preis="17,90" />
|
||||
<zustieg idbuspro="27" zeit="03:45" />',
|
||||
<zustieg idbuspro="4" zeit="12.12.2026 22:30:00" preis="17,90" />',
|
||||
'<zustieg_rueck idbuspro="18" />
|
||||
<zustieg_rueck idbuspro="27" />'
|
||||
);
|
||||
|
||||
$this->assertSame(17.9, $travel->dropOffs[18]->price);
|
||||
$this->assertSame(17.9, $travel->dropOffs[18]->priceInbound);
|
||||
$this->assertSame(17.9, $travel->pickups[18]->priceInbound);
|
||||
|
||||
// A point that is free outbound stays free on the return leg
|
||||
$this->assertNull($travel->dropOffs[27]->price);
|
||||
$this->assertNull($travel->pickups[27]->priceInbound);
|
||||
}
|
||||
|
||||
public function testPickupInheritsTheDropOffPriceWhenTheOutboundLegStatesNone(): void
|
||||
{
|
||||
// The mirror image of the product 701 defect: an asymmetric pair is a defect
|
||||
// whichever leg is missing, so the stated price applies to both.
|
||||
$travel = $this->parseTravelWithBoardingPoints(
|
||||
'<zustieg idbuspro="18" zeit="12.12.2026 21:45:00" />',
|
||||
'<zustieg_rueck idbuspro="18" preis="17,90" />'
|
||||
<zustieg_rueck idbuspro="4" preis="9,90" />'
|
||||
);
|
||||
|
||||
$this->assertSame(17.9, $travel->pickups[18]->price);
|
||||
$this->assertSame(17.9, $travel->pickups[18]->priceOutbound);
|
||||
$this->assertSame(17.9, $travel->dropOffs[18]->price);
|
||||
}
|
||||
$this->assertNull($travel->pickups[18]->priceInbound);
|
||||
$this->assertNull($travel->dropOffs[18]->price);
|
||||
|
||||
public function testConflictingBoardingPricesResolveToTheOutboundOne(): void
|
||||
{
|
||||
$travel = $this->parseTravelWithBoardingPoints(
|
||||
'<zustieg idbuspro="18" zeit="12.12.2026 21:45:00" preis="17,90" />',
|
||||
'<zustieg_rueck idbuspro="18" preis="9,90" />'
|
||||
);
|
||||
|
||||
$this->assertSame(17.9, $travel->pickups[18]->price);
|
||||
$this->assertSame(17.9, $travel->dropOffs[18]->price);
|
||||
$this->assertSame(17.9, $travel->pickups[4]->price);
|
||||
$this->assertSame(9.9, $travel->dropOffs[4]->price);
|
||||
}
|
||||
|
||||
public function testDropOffWithoutAPickupCounterpartKeepsItsOwnPrice(): void
|
||||
@@ -412,27 +386,12 @@ class TravelParserTest extends TestCase
|
||||
$this->assertSame(5.9, $travel->dropOffs[99]->price);
|
||||
}
|
||||
|
||||
public function testBoardingPricesAreReportedVerbatimWhenLevellingIsDisabled(): void
|
||||
private function createParser(): TravelParser
|
||||
{
|
||||
// The levelling compensates a vendor export defect and is therefore switchable.
|
||||
// With it off the product 701 shape undercharges the return leg again.
|
||||
$travel = $this->parseTravelWithBoardingPoints(
|
||||
'<zustieg idbuspro="18" zeit="12.12.2026 21:45:00" preis="17,90" />',
|
||||
'<zustieg_rueck idbuspro="18" />',
|
||||
$this->createParser(levelBoardingPointPrices: false)
|
||||
);
|
||||
|
||||
$this->assertSame(17.9, $travel->pickups[18]->price);
|
||||
$this->assertNull($travel->pickups[18]->priceInbound);
|
||||
$this->assertNull($travel->dropOffs[18]->price);
|
||||
return new TravelParser(new AgeConstraintParserRegistry());
|
||||
}
|
||||
|
||||
private function createParser(bool $levelBoardingPointPrices = true): TravelParser
|
||||
{
|
||||
return new TravelParser(new AgeConstraintParserRegistry(), $levelBoardingPointPrices);
|
||||
}
|
||||
|
||||
private function parseTravelWithBoardingPoints(string $pickups, string $dropOffs, ?TravelParser $parser = null): Travel
|
||||
private function parseTravelWithBoardingPoints(string $pickups, string $dropOffs): Travel
|
||||
{
|
||||
$xmlContent = '<?xml version="1.0" encoding="utf-8"?>
|
||||
<reisen>
|
||||
@@ -447,7 +406,7 @@ class TravelParserTest extends TestCase
|
||||
|
||||
$crawler = XmlCrawlerFactory::create($xmlContent);
|
||||
|
||||
return ($parser ?? $this->parser)->parse($crawler->filterXPath('//reise/termin')->first());
|
||||
return $this->parser->parse($crawler->filterXPath('//reise/termin')->first());
|
||||
}
|
||||
|
||||
public function testGetPickupsAdjustsOvernightTimes(): void
|
||||
|
||||
@@ -488,7 +488,7 @@ class ParticipantFieldOptionsProviderBabyTest extends TestCase
|
||||
*/
|
||||
private function createTravelWithExportedSkiPasses(array $serviceIds): Travel
|
||||
{
|
||||
$parser = new TravelParser(new AgeConstraintParserRegistry(), true);
|
||||
$parser = new TravelParser(new AgeConstraintParserRegistry());
|
||||
$crawler = XmlCrawlerFactory::create(file_get_contents('/var/www/html/var/xmlexport/Ziel_2456.xml'));
|
||||
$travelNode = $crawler->filterXPath('//reise/termin')->first();
|
||||
$travel = $parser->parse($travelNode);
|
||||
|
||||
@@ -288,8 +288,7 @@ class ProductExportBuilderTest extends TestCase
|
||||
|
||||
return (new ProductExportBuilder(
|
||||
$pickupLoader,
|
||||
// Levelling on, to prove the export does not go through it.
|
||||
new TravelParser(new AgeConstraintParserRegistry([]), true),
|
||||
new TravelParser(new AgeConstraintParserRegistry([])),
|
||||
new ProductExportParser(),
|
||||
$filesystem,
|
||||
new TagAwareAdapter(new ArrayAdapter()),
|
||||
|
||||
@@ -264,7 +264,7 @@ class TravelExportBuilderTest extends TestCase
|
||||
return (new TravelExportBuilder(
|
||||
$hotelLoader,
|
||||
$pickupLoader,
|
||||
new TravelParser(new AgeConstraintParserRegistry([]), false),
|
||||
new TravelParser(new AgeConstraintParserRegistry([])),
|
||||
$filesystem,
|
||||
new TagAwareAdapter(new ArrayAdapter()),
|
||||
new NullLogger(),
|
||||
|
||||
Reference in new issue
Block a user