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