fix: properly assign readonly state to form fields for unavailable services
This commit is contained in:
@@ -49,57 +49,6 @@ class TravelTest extends TestCase
|
||||
$this->assertSame($inboundPkw, $inboundResult[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that unavailable services are filtered out when filterAvailable is true.
|
||||
*/
|
||||
public function testUnavailableServicesFiltered(): void
|
||||
{
|
||||
$travel = new Travel();
|
||||
|
||||
$availablePkw = new Service();
|
||||
$availablePkw->id = 1;
|
||||
$availablePkw->subType = 'PKW';
|
||||
$availablePkw->direction = 'HIN';
|
||||
$availablePkw->label = 'Eigene Anreise';
|
||||
$availablePkw->available = 10;
|
||||
|
||||
$unavailablePkw = new Service();
|
||||
$unavailablePkw->id = 2;
|
||||
$unavailablePkw->subType = 'PKW';
|
||||
$unavailablePkw->direction = 'HIN';
|
||||
$unavailablePkw->label = 'Eigene Anreise mit Rabatt';
|
||||
$unavailablePkw->available = 0;
|
||||
|
||||
$travel->transportationServices = [$availablePkw, $unavailablePkw];
|
||||
|
||||
$result = $travel->getTransportationServicesByDirection('HIN', true);
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertSame($availablePkw, $result[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that services with null availability are included.
|
||||
*/
|
||||
public function testNullAvailabilityIncluded(): void
|
||||
{
|
||||
$travel = new Travel();
|
||||
|
||||
$pkwWithNullAvailability = new Service();
|
||||
$pkwWithNullAvailability->id = 1;
|
||||
$pkwWithNullAvailability->subType = 'PKW';
|
||||
$pkwWithNullAvailability->direction = 'HIN';
|
||||
$pkwWithNullAvailability->label = 'Eigene Anreise';
|
||||
$pkwWithNullAvailability->available = null;
|
||||
|
||||
$travel->transportationServices = [$pkwWithNullAvailability];
|
||||
|
||||
$result = $travel->getTransportationServicesByDirection('HIN', true);
|
||||
|
||||
$this->assertCount(1, $result);
|
||||
$this->assertSame($pkwWithNullAvailability, $result[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Test that multiple PKW services are all returned (no smart filtering at Travel level).
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user