Skip to content
Snippets Groups Projects
Commit 49bca5b7 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

Remove 'time' option from WWW::Efa

parent b9c18d67
No related branches found
No related tags found
No related merge requests found
...@@ -53,7 +53,7 @@ sub post_time { ...@@ -53,7 +53,7 @@ sub post_time {
my ($post, $conf) = @_; my ($post, $conf) = @_;
my $time; my $time;
if ($conf->{'depart'} || $conf->{'time'}) { if ($conf->{'depart'}) {
$post->{'itdTripDateTimeDepArr'} = 'dep'; $post->{'itdTripDateTimeDepArr'} = 'dep';
$time = $conf->{'depart'} || $conf->{'time'}; $time = $conf->{'depart'} || $conf->{'time'};
} }
...@@ -64,7 +64,8 @@ sub post_time { ...@@ -64,7 +64,8 @@ sub post_time {
if ($time !~ / ^ [0-2]? \d : [0-5]? \d $ /x) { if ($time !~ / ^ [0-2]? \d : [0-5]? \d $ /x) {
die WWW::Efa::Error::Setup->new( die WWW::Efa::Error::Setup->new(
'time', $time, 'Must match HH:MM' ($conf->{'depart'} ? 'depart' : 'arrive'),
$time, 'Must match HH:MM'
); );
} }
@{$post}{'itdTimeHour', 'itdTimeMinute'} = split(/:/, $time); @{$post}{'itdTimeHour', 'itdTimeMinute'} = split(/:/, $time);
...@@ -179,7 +180,7 @@ sub create_post { ...@@ -179,7 +180,7 @@ sub create_post {
if ($conf->{'via'}) { if ($conf->{'via'}) {
post_place($post, 'via', @{$conf->{'via'}}); post_place($post, 'via', @{$conf->{'via'}});
} }
if ($conf->{'arrive'} || $conf->{'depart'} || $conf->{'time'}) { if ($conf->{'arrive'} || $conf->{'depart'}) {
post_time($post, $conf); post_time($post, $conf);
} }
if ($conf->{'date'}) { if ($conf->{'date'}) {
...@@ -343,7 +344,7 @@ contain. See B<from> for arguments. ...@@ -343,7 +344,7 @@ contain. See B<from> for arguments.
Sets the journey end time Sets the journey end time
=item B<depart>|B<time> => I<HH:MM> =item B<depart> => I<HH:MM>
Sets the journey start time Sets the journey start time
......
...@@ -3,7 +3,7 @@ use strict; ...@@ -3,7 +3,7 @@ use strict;
use warnings; use warnings;
use 5.010; use 5.010;
use Test::More tests => 135; use Test::More tests => 131;
BEGIN { BEGIN {
use_ok('WWW::Efa'); use_ok('WWW::Efa');
...@@ -115,13 +115,6 @@ is_efa_post( ...@@ -115,13 +115,6 @@ is_efa_post(
['type_origin', 'address'], ['type_origin', 'address'],
); );
is_efa_post(
'time', '22:23',
['itdTripDateTimeDepArr', 'dep'],
['itdTimeHour', '22'],
['itdTimeMinute', '23'],
);
is_efa_post( is_efa_post(
'depart', '22:23', 'depart', '22:23',
['itdTripDateTimeDepArr', 'dep'], ['itdTripDateTimeDepArr', 'dep'],
...@@ -137,12 +130,12 @@ is_efa_post( ...@@ -137,12 +130,12 @@ is_efa_post(
); );
is_efa_err( is_efa_err(
'time', '37:00', 'depart', '37:00',
'Must match HH:MM', 'Must match HH:MM',
); );
is_efa_err( is_efa_err(
'time', '07', 'depart', '07',
'Must match HH:MM', 'Must match HH:MM',
); );
......
...@@ -94,13 +94,23 @@ for my $opt (qw/-w --walk-speed/) { ...@@ -94,13 +94,23 @@ for my $opt (qw/-w --walk-speed/) {
); );
} }
for my $opt (qw/-t --time --depart -a --arrive/) { for my $opt (qw/-t --time --depart/) {
$cmd = Test::Command->new(cmd => "$efa $opt 35:12 $testarg"); $cmd = Test::Command->new(cmd => "$efa $opt 35:12 $testarg");
$cmd->exit_isnt_num(0); $cmd->exit_isnt_num(0);
$cmd->stdout_is_eq($EMPTY); $cmd->stdout_is_eq($EMPTY);
$cmd->stderr_is_eq( $cmd->stderr_is_eq(
mk_err('time', '35:12', 'Must match HH:MM') mk_err('depart', '35:12', 'Must match HH:MM')
);
}
for my $opt (qw/-a --arrive/) {
$cmd = Test::Command->new(cmd => "$efa $opt 35:12 $testarg");
$cmd->exit_isnt_num(0);
$cmd->stdout_is_eq($EMPTY);
$cmd->stderr_is_eq(
mk_err('arrive', '35:12', 'Must match HH:MM')
); );
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment