Lines 22-28
Link Here
|
22 |
|
22 |
|
23 |
use Modern::Perl; |
23 |
use Modern::Perl; |
24 |
|
24 |
|
25 |
use Test::More tests => 4; |
25 |
use Test::More tests => 7; |
26 |
use Test::MockModule; |
26 |
use Test::MockModule; |
27 |
use t::lib::TestBuilder; |
27 |
use t::lib::TestBuilder; |
28 |
use t::lib::Mocks; |
28 |
use t::lib::Mocks; |
Lines 96-113
ReNewSubscription(
Link Here
|
96 |
); |
96 |
); |
97 |
|
97 |
|
98 |
# Calculate the subscription length for the renewal for issues, days and months |
98 |
# Calculate the subscription length for the renewal for issues, days and months |
99 |
my ($numberlength, $weeklength, $monthlength) = getsublength('issues', 7); |
99 |
my ($numberlength, $weeklength, $monthlength) = GetSubscriptionLength('issues', 7); |
100 |
is ( $numberlength, 7, "Sub length is 7 issues"); |
100 |
is ( $numberlength, 7, "Subscription length is 7 issues"); |
101 |
|
101 |
|
102 |
($numberlength, $weeklength, $monthlength) = getsublength('weeks', 7); |
102 |
($numberlength, $weeklength, $monthlength) = GetSubscriptionLength('weeks', 7); |
103 |
is ( $weeklength, 7, "Sub length is 7 weeks"); |
103 |
is ( $weeklength, 7, "Subscription length is 7 weeks"); |
104 |
|
104 |
|
105 |
($numberlength, $weeklength, $monthlength) = getsublength('months', 7); |
105 |
($numberlength, $weeklength, $monthlength) = GetSubscriptionLength('months', 7); |
106 |
is ( $monthlength, 7, "Sub length is 7 months"); |
106 |
is ( $monthlength, 7, "Subscription length is 7 months"); |
|
|
107 |
|
108 |
# Check subscription length when no value is inputted into the numeric sublength field |
109 |
($numberlength, $weeklength, $monthlength) = GetSubscriptionLength('months', ''); |
110 |
is ($monthlength, undef, "Subscription length is undef months, invalid month data was not stored"); |
111 |
|
112 |
# Check subscription length when a letter is inputted into the numeric sublength field |
113 |
($numberlength, $weeklength, $monthlength) = GetSubscriptionLength('issues', 'w'); |
114 |
is ($monthlength, undef, "Subscription length is undef issues, invalid issue data was not stored"); |
115 |
|
116 |
# Check subscription length when a special character is inputted into numberic sublength field |
117 |
($numberlength, $weeklength, $monthlength) = GetSubscriptionLength('weeks', '!'); |
118 |
is ($weeklength, undef, "Subscription length is undef weeks, invalid weeks data was not stored"); |
107 |
|
119 |
|
108 |
# Renew the subscription and check that enddate has not been set |
120 |
# Renew the subscription and check that enddate has not been set |
109 |
|
121 |
|
110 |
ReNewSubscription($subscription->{subscriptionid},'',"2016-01-01",'','',12,''); |
|
|
111 |
my $history = Koha::Subscription::Histories->find($subscription->{subscriptionid}); |
122 |
my $history = Koha::Subscription::Histories->find($subscription->{subscriptionid}); |
112 |
|
123 |
|
113 |
is ( $history->histenddate(), undef, 'subscription history not empty after renewal'); |
124 |
is ( $history->histenddate(), undef, 'subscription history not empty after renewal'); |
114 |
- |
|
|