summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Travel/Status/DE/HAFAS.pm6
-rwxr-xr-xt/20-db.t12
2 files changed, 12 insertions, 6 deletions
diff --git a/lib/Travel/Status/DE/HAFAS.pm b/lib/Travel/Status/DE/HAFAS.pm
index 2c2b6b5..c313a44 100644
--- a/lib/Travel/Status/DE/HAFAS.pm
+++ b/lib/Travel/Status/DE/HAFAS.pm
@@ -612,6 +612,11 @@ sub parse_mgate {
my $train_type = $product->{prodCtx}{catOutS};
my $line_no = $product->{prodCtx}{line};
+ my $operator = $opL[ $product->{oprX} ];
+ if ($operator) {
+ $operator = $operator->{name};
+ }
+
push(
@{ $self->{results} },
Travel::Status::DE::HAFAS::Result->new(
@@ -622,6 +627,7 @@ sub parse_mgate {
delay => $delay,
is_cancelled => $is_cancelled,
train => $train,
+ operator => $operator,
route_end => $destination,
platform => $platform,
new_platform => $new_platform,
diff --git a/t/20-db.t b/t/20-db.t
index 65c7ba5..b206a51 100755
--- a/t/20-db.t
+++ b/t/20-db.t
@@ -52,8 +52,8 @@ for my $res ( $results[0]->line_no, $results[0]->train_no ) {
is( $res, 300, 'result 0: line/train number' );
}
-is( $results[0]->operator, undef, 'result 0: no operator' );
-is( $results[0]->platform, undef, 'result 0: platform' );
+is( $results[0]->operator, 'Nahreisezug', 'result 0: operator' );
+is( $results[0]->platform, undef, 'result 0: platform' );
for my $res ( $results[0]->route_end, $results[0]->destination,
$results[0]->origin )
@@ -90,8 +90,8 @@ for my $res ( $results[2]->line_no, $results[2]->train_no ) {
is( $res, 8, 'result 2: line/train number' );
}
-is( $results[2]->operator, undef, 'result 2: no operator' );
-is( $results[2]->platform, undef, 'result 2: no platform' );
+is( $results[2]->operator, 'Nahreisezug', 'result 2: operator' );
+is( $results[2]->platform, undef, 'result 2: no platform' );
for my $res ( $results[2]->route_end, $results[2]->destination,
$results[2]->origin )
@@ -128,8 +128,8 @@ for my $res ( $results[3]->line_no, $results[3]->train_no ) {
is( $res, 3, 'result 3: line/train number' );
}
-is( $results[3]->operator, undef, 'result 3: no operator' );
-is( $results[3]->platform, 4, 'result 3: platform' );
+is( $results[3]->operator, 'S-Bahn Berlin', 'result 3: operator' );
+is( $results[3]->platform, 4, 'result 3: platform' );
for my $res ( $results[3]->route_end, $results[3]->destination,
$results[3]->origin )