summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
Diffstat (limited to 't')
-rw-r--r--t/21-vrr-ambig.t28
-rw-r--r--t/in/essen_alfredusbad_ambiguous.xml81
2 files changed, 109 insertions, 0 deletions
diff --git a/t/21-vrr-ambig.t b/t/21-vrr-ambig.t
new file mode 100644
index 0000000..7dd96a4
--- /dev/null
+++ b/t/21-vrr-ambig.t
@@ -0,0 +1,28 @@
+#!/usr/bin/env perl
+use strict;
+use warnings;
+use 5.010;
+use utf8;
+
+use File::Slurp qw(slurp);
+use Test::More tests => 7;
+
+BEGIN {
+ use_ok('Travel::Status::DE::VRR');
+}
+require_ok('Travel::Status::DE::VRR');
+
+my $xml = slurp('t/in/essen_alfredusbad_ambiguous.xml');
+
+my $status = Travel::Status::DE::VRR->new_from_xml(xml => $xml);
+
+isa_ok($status, 'Travel::Status::DE::VRR');
+can_ok($status, qw(errstr results));
+
+$status->check_for_ambiguous();
+
+is($status->errstr, 'Ambiguous name input: Alfredusbad | Am Alfredusbad',
+ 'errstr ok');
+
+is_deeply([$status->lines], [], 'no lines');
+is_deeply([$status->results], [], 'no results');
diff --git a/t/in/essen_alfredusbad_ambiguous.xml b/t/in/essen_alfredusbad_ambiguous.xml
new file mode 100644
index 0000000..9b3e589
--- /dev/null
+++ b/t/in/essen_alfredusbad_ambiguous.xml
@@ -0,0 +1,81 @@
+<?xml version="1.0" encoding="utf-8"?>
+<itdRequest version="9.16.27.53" language="de" lengthUnit="METER" sessionID="efa1.vrr.de_36925562" client="libwww-perl/6.03" clientIP="87.147.17.185" serverID="efa1.vrr.de_" virtDir="vrr" now="2011-11-20T12:18:48" nowWD="1">
+ <itdLayoutParams>
+ <itdLayoutParam name="mdvMap2_dm" value="" />
+ <itdLayoutParam name="mapState_dm" value="" />
+ <itdLayoutParam name="mdvMap_dm" value="3406199:401077:NAV3" />
+ <itdLayoutParam name="view" value="" />
+ <itdLayoutParam name="id_dm" value=":dm" />
+ <itdLayoutParam name="transpCompany" value="vrr" />
+ </itdLayoutParams>
+ <itdDepartureMonitorRequest requestID="1">
+ <itdOdv type="stop" usage="dm">
+ <itdOdvPlace state="identified" method="itp">
+ <odvPlaceElem omc="5113000" placeID="18" value="5113000:18" span="0" type="remote" mainPlace="1">Essen</odvPlaceElem>
+ <odvPlaceInput>E</odvPlaceInput>
+ </itdOdvPlace>
+ <itdOdvName state="list" method="itp">
+ <itdMessage type="error" module="BROKER" code="1">name list</itdMessage>
+ <odvNameElem listIndex="0" selected="0" matchQuality="999010" stopID="20009115" value="0:1">Alfredusbad</odvNameElem>
+ <odvNameElem listIndex="1" selected="0" matchQuality="996010" stopID="20009903" value="1:2">Am Alfredusbad</odvNameElem>
+ <odvNameInput>Afredusbad</odvNameInput>
+ </itdOdvName>
+ </itdOdv>
+ <itdDateTime ttpFrom="20110901" ttpTo="20120531">
+ <itdDate weekday="1" year="2011" month="11" day="20" />
+ <itdTime hour="12" minute="20" />
+ </itdDateTime>
+ <itdDateRange>
+ <itdDate day="20" month="11" year="2011" weekday="1" />
+ <itdDate day="21" month="11" year="2011" weekday="2" />
+ <itdDate day="22" month="11" year="2011" weekday="3" />
+ <itdDate day="23" month="11" year="2011" weekday="4" />
+ <itdDate day="24" month="11" year="2011" weekday="5" />
+ <itdDate day="25" month="11" year="2011" weekday="6" />
+ <itdDate day="26" month="11" year="2011" weekday="7" />
+ <itdDate day="27" month="11" year="2011" weekday="1" />
+ <itdDate day="28" month="11" year="2011" weekday="2" />
+ <itdDate day="29" month="11" year="2011" weekday="3" />
+ <itdDate day="30" month="11" year="2011" weekday="4" />
+ <itdDate day="01" month="12" year="2011" weekday="5" />
+ <itdDate day="02" month="12" year="2011" weekday="6" />
+ <itdDate day="03" month="12" year="2011" weekday="7" />
+ <itdDate day="04" month="12" year="2011" weekday="1" />
+ </itdDateRange>
+ <itdTripOptions>
+ <itdPtOptions>
+ <excludedMeans>
+ <meansElem value="0" selected="0">Zug</meansElem>
+ <meansElem value="1" selected="0">S-Bahn</meansElem>
+ <meansElem value="2" selected="0">U-Bahn</meansElem>
+ <meansElem value="3" selected="0">Stadtbahn</meansElem>
+ <meansElem value="4" selected="0">Straßen-/Trambahn</meansElem>
+ <meansElem value="5" selected="0">Stadtbus</meansElem>
+ <meansElem value="6" selected="0">Regionalbus</meansElem>
+ <meansElem value="7" selected="0">Schnellbus</meansElem>
+ <meansElem value="8" selected="0">Seil-/Zahnradbahn</meansElem>
+ <meansElem value="9" selected="0">Schiff</meansElem>
+ <meansElem value="10" selected="0">AST/Rufbus</meansElem>
+ <meansElem value="11" selected="0">Sonstige</meansElem>
+ </excludedMeans>
+ </itdPtOptions>
+ <itdItOptions>
+ <itRouter logASCII="false" logSVG="false" />
+ <itPedestrian computeMonomodalTrip="false" computationType="PT_AND_IT" itIncidentData="false" useElevation="false" speedFactor="100" costFactor="0" distanceFactor="50" traveltimeFactor="50" noTunnel="false" noBridge="false" noFerry="false" maxTime="20" maxLength="2147483647" ignoreRestrictions="false" />
+ <itBicycle preferAsphaltTracks="false" preferGreenTracks="false" usePseudoRouting="false" useSignedRoute="false" cycleSpeed="20" prefHikePath="false" elevFac="50" bikeProf="UNKNOWN" computeMonomodalTrip="false" computationType="PT_AND_IT" itIncidentData="false" useElevation="false" speedFactor="100" costFactor="0" distanceFactor="50" traveltimeFactor="50" noTunnel="false" noBridge="false" noFerry="false" maxTime="15" maxLength="2147483647" ignoreRestrictions="false" />
+ <mitCar computeMonomodalTrip="false" computationType="PT_AND_IT" itIncidentData="false" useElevation="false" speedFactor="100" costFactor="0" distanceFactor="10" traveltimeFactor="90" noTunnel="false" noBridge="false" noFerry="false" maxTime="90" maxLength="2147483647" ignoreRestrictions="false" mitProfileData="false" mitIncidentData="false" mitOnlineData="false" noHighway="false" noTollRoad="false" />
+ <departureTransport>
+ <individualTransport meansCode="100" value="8" speed="normal" selected="1" />
+ <individualTransport meansCode="101" value="15" speed="normal" selected="0" />
+ <individualTransport meansCode="102" value="15" speed="normal" selected="0" />
+ <individualTransport meansCode="103" value="10" speed="normal" selected="0" />
+ <individualTransport meansCode="104" value="10" speed="normal" selected="0" />
+ <individualTransport meansCode="105" value="30" speed="normal" selected="0" />
+ <individualTransport meansCode="106" value="15" speed="normal" selected="0" />
+ <individualTransport meansCode="107" value="15" speed="normal" selected="0" />
+ </departureTransport>
+ </itdItOptions>
+ </itdTripOptions>
+ </itdDepartureMonitorRequest>
+</itdRequest>
+