fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2012-05-01 11:53 am

[dw-free] paid-time.t still has problems with February

[commit: http://hg.dwscoalition.org/dw-free/rev/f12703db8010]

http://bugs.dwscoalition.org/show_bug.cgi?id=4306

Adjust tests for edge cases.

Patch by [personal profile] kareila.

Files modified:
  • t/paid-time.t
--------------------------------------------------------------------------------
diff -r 3a759a0be895 -r f12703db8010 t/paid-time.t
--- a/t/paid-time.t	Tue May 01 19:47:35 2012 +0800
+++ b/t/paid-time.t	Tue May 01 19:53:38 2012 +0800
@@ -38,6 +38,7 @@
 
         my $ps = DW::Pay::get_paid_status( $u );
         my $secs = 86400 * $paidmos;
+        $ps->{expiresin} = $secs if $type eq 'seed';  # not relevant to test
         ok( $ps, 'got paid status' );
         ok( $ps->{typeid} == $typeid, 'typeids match' );
         ok( abs( $ps->{expiresin} - $secs) < 60, 'secs match within a minute' );
@@ -82,7 +83,7 @@
 # paid +1 month == premium +21 days
 DW::Pay::add_paid_time( $u1, 'paid', 1 )
     or die DW::Pay::error_text();
-$paidmos += int( $mdays * 0.7 );  # 123
+$paidmos += 21;  # 123
 
 assert( $u1, 'premium', "paid +1 month == premium +21 days" );
 
--------------------------------------------------------------------------------