Unverified Commit a02fc782 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

mgate: parse operator

parent f3beaf2d
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -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,
+6 −6
Original line number Diff line number Diff line
@@ -52,7 +52,7 @@ 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]->operator, 'Nahreisezug', 'result 0: operator' );
is( $results[0]->platform, undef,         'result 0: platform' );

for my $res ( $results[0]->route_end, $results[0]->destination,
@@ -90,7 +90,7 @@ 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]->operator, 'Nahreisezug', 'result 2: operator' );
is( $results[2]->platform, undef,         'result 2: no platform' );

for my $res ( $results[2]->route_end, $results[2]->destination,
@@ -128,7 +128,7 @@ 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]->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,