parser = new AvailabilitiesParser();
}
public function testMapsLiveServiceStatusOntoExportVocabulary(): void
{
$xml = '
';
$services = $this->parser->parseServices(XmlCrawlerFactory::create($xml))->getServices();
$this->assertSame(Constants::STATUS_AVAILABLE, $services[201200]->status);
$this->assertSame(3, $services[201200]->available);
$this->assertSame(Constants::STATUS_BLOCKED, $services[201590]->status);
$this->assertSame(0, $services[201590]->available);
}
public function testPassesExportVocabularyAndUnknownStatusThrough(): void
{
$xml = '
';
$services = $this->parser->parseServices(XmlCrawlerFactory::create($xml))->getServices();
$this->assertSame(Constants::STATUS_ON_REQUEST, $services[1]->status);
$this->assertSame('unbekannt', $services[2]->status);
$this->assertNull($services[3]->status);
}
public function testLeavesTravelLevelStatusUntouched(): void
{
$xml = '
';
$response = $this->parser->parseServices(XmlCrawlerFactory::create($xml));
$this->assertSame('frei', $response->travelStatus);
$this->assertSame(['F', 'O', 'A'], $response->allowedBookingStatus);
}
}