add ARB (recurring authorizations/subscriptions) support
[Business-OnlinePayment-AuthorizeNet.git] / t / lib / test_account.pl
index b86082b..0b06973 100644 (file)
@@ -1,5 +1,6 @@
 sub test_account_or_skip {
-    my($login, $password) = test_account();
+    my $suffix = shift;
+    my($login, $password) = test_account($suffix);
 
     unless( defined $login ) {
         plan skip_all => "No test account";
@@ -9,7 +10,9 @@ sub test_account_or_skip {
 }
 
 sub test_account {
-    open TEST_ACCOUNT, "t/test_account" or return;
+    my $suffix = shift || '';
+    $suffix = "_$suffix" if $suffix;
+    open TEST_ACCOUNT, "t/test_account$suffix" or return;
     my($login, $password) = <TEST_ACCOUNT>;
     chomp $login;
     chomp $password;
@@ -25,4 +28,9 @@ sub expiration_date {
     return sprintf("%02d/%02d", $month, $year);
 }
 
+sub tomorrow {
+    my($day, $month, $year) = (localtime(time+86400))[3..5];
+    return sprintf("%04d-%02d-%02d", $year+1900, ++$month, $day);
+}
+
 1;