fix: map live service status to export wording
This commit is contained in:
1 parent
d8fe9a3875
commit
09610889f3
7 files changed
+129
-11
No files matched your search
@@ -4,6 +4,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace App\Tests\BusProNet\XmlParser;
|
||||
|
||||
use App\BusProNet\Constants;
|
||||
use App\BusProNet\XmlCrawlerFactory;
|
||||
use App\BusProNet\XmlParser\ExtendedAvailabilitiesParser;
|
||||
use PHPUnit\Framework\TestCase;
|
||||
@@ -48,6 +49,22 @@ class ExtendedAvailabilitiesParserTest extends TestCase
|
||||
$this->assertTrue($availability->mandatory);
|
||||
}
|
||||
|
||||
public function testMapsLiveServiceStatusOntoExportVocabulary(): void
|
||||
{
|
||||
$xml = '<?xml version="1.0" encoding="utf-8"?>
|
||||
<ergebnis>
|
||||
<leistungen>
|
||||
<leistung id="103" status="buchbar" frei="3" preis="0,00" />
|
||||
<leistung id="104" status="ausgebucht" anfragemoeglich="J" frei="0" preis="0,00" />
|
||||
</leistungen>
|
||||
</ergebnis>';
|
||||
|
||||
$services = $this->parser->parseServices(XmlCrawlerFactory::create($xml))->getServices();
|
||||
|
||||
$this->assertSame(Constants::STATUS_AVAILABLE, $services[103]->status);
|
||||
$this->assertSame(Constants::STATUS_BLOCKED, $services[104]->status);
|
||||
}
|
||||
|
||||
public function testIgnoresEmptyAgeAndMandatoryAttributes(): void
|
||||
{
|
||||
$xml = '<?xml version="1.0" encoding="utf-8"?>
|
||||
|
||||
Reference in new issue
Block a user