summaryrefslogtreecommitdiff
path: root/t/20-vrr.t
blob: d1ee22bd2fee3ca0927649975106745085858fe2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#!/usr/bin/env perl
use strict;
use warnings;
use 5.010;

use File::Slurp qw(slurp);
use Test::More skip_all => 'outdated';

BEGIN {
	use_ok('Travel::Status::DE::VRR');
}
require_ok('Travel::Status::DE::VRR');

my $html = slurp('t/in/essen_bp.html');

my $status = Travel::Status::DE::VRR->new_from_html(xml => $html);

isa_ok($status, 'Travel::Status::DE::VRR');
can_ok($status, qw(errstr results));

my @results = $status->results;

for my $result (@results) {
	isa_ok($result, 'Travel::Status::DE::VRR::Result');
	can_ok($result, qw(destination info line time platform));
}

is($results[0]->destination, 'Essen Wertstr.', 'first result: destination ok');
is($results[0]->info, q{}, 'first result: no info');
is($results[0]->line, '103', 'first result: line ok');
is($results[0]->time, '20:19', 'first result: time ok');
is($results[0]->platform, 'Bstg. 1', 'first result: platform ok');

is($results[-1]->destination, 'Essen Germaniaplatz', 'last result: destination ok');
is($results[-1]->info, q{}, 'last result: no info');
is($results[-1]->line, '101', 'last result: line ok');
is($results[-1]->time, '21:07', 'last result: time ok');
is($results[-1]->platform, 'Bstg. 1', 'last result: platform ok');