Initial import
[Business-OnlinePayment-Vanco.git] / t / lib / test_account.pl
1 sub test_account_or_skip {
2     my $suffix = shift;
3     my($login, $password, @opts) = test_account($suffix);
4
5     unless( defined $login ) {
6         plan skip_all => "No test account";
7     }
8
9     return($login, $password, @opts);
10 }
11
12 sub test_account {
13     my $suffix = shift || '';
14     $suffix = "_$suffix" if $suffix;
15     open TEST_ACCOUNT, "t/test_account$suffix" or return;
16     my($login, $password, @opts) = <TEST_ACCOUNT>;
17     chomp $login;
18     chomp $password;
19     chomp foreach @opts;
20
21     return($login, $password, @opts);
22 }
23
24 sub expiration_date {
25     my($month, $year) = (localtime)[4,5];
26     $year++;       # So we expire next year.
27     $year %= 100;  # y2k?  What's that?
28
29     return sprintf("%02d/%02d", $month, $year);
30 }
31
32 sub tomorrow {
33     my($day, $month, $year) = (localtime(time+86400))[3..5];
34     return sprintf("%04d-%02d-%02d", $year+1900, ++$month, $day);
35 }
36
37 1;