|
Lines 17-23
use Koha::Acquisition::Booksellers;
Link Here
|
| 17 |
use t::lib::Mocks; |
17 |
use t::lib::Mocks; |
| 18 |
use t::lib::TestBuilder; |
18 |
use t::lib::TestBuilder; |
| 19 |
use Test::MockModule; |
19 |
use Test::MockModule; |
| 20 |
use Test::More tests => 55; |
20 |
use Test::More tests => 57; |
| 21 |
|
21 |
|
| 22 |
BEGIN { |
22 |
BEGIN { |
| 23 |
use_ok('C4::Serials', qw( updateClaim NewSubscription GetSubscription GetSubscriptionHistoryFromSubscriptionId SearchSubscriptions ModSubscription GetExpirationDate GetSerials GetSerialInformation NewIssue AddItem2Serial DelSubscription GetFullSubscription PrepareSerialsData GetSubscriptionsFromBiblionumber ModSubscriptionHistory GetSerials2 GetLatestSerials GetNextSeq GetSeq CountSubscriptionFromBiblionumber ModSerialStatus findSerialsByStatus HasSubscriptionStrictlyExpired HasSubscriptionExpired GetLateOrMissingIssues check_routing addroutingmember GetNextDate )); |
23 |
use_ok('C4::Serials', qw( updateClaim NewSubscription GetSubscription GetSubscriptionHistoryFromSubscriptionId SearchSubscriptions ModSubscription GetExpirationDate GetSerials GetSerialInformation NewIssue AddItem2Serial DelSubscription GetFullSubscription PrepareSerialsData GetSubscriptionsFromBiblionumber ModSubscriptionHistory GetSerials2 GetLatestSerials GetNextSeq GetSeq CountSubscriptionFromBiblionumber ModSerialStatus findSerialsByStatus HasSubscriptionStrictlyExpired HasSubscriptionExpired GetLateOrMissingIssues check_routing addroutingmember GetNextDate )); |
|
Lines 199-204
is(
Link Here
|
| 199 |
'SearchSubscriptions returned only one subscription when results_limit is set to "1"' |
199 |
'SearchSubscriptions returned only one subscription when results_limit is set to "1"' |
| 200 |
); |
200 |
); |
| 201 |
|
201 |
|
|
|
202 |
# Set up fake data |
| 203 |
my $subscriptionwithroutinglistid = NewSubscription( |
| 204 |
undef, "", undef, undef, $budget_id, $biblionumber, |
| 205 |
'2013-01-01', $frequency_id, undef, undef, undef, |
| 206 |
undef, undef, undef, undef, undef, undef, |
| 207 |
1, $notes, undef, '2013-01-01', undef, $pattern_id, |
| 208 |
undef, undef, 0, $internalnotes, 0, |
| 209 |
undef, undef, 0, undef, '2013-12-31', 0 |
| 210 |
); |
| 211 |
|
| 212 |
#creating fake patrons |
| 213 |
my $patron = $builder->build_object( |
| 214 |
{ |
| 215 |
class => 'Koha::Patrons', |
| 216 |
} |
| 217 |
); |
| 218 |
my $patron2 = $builder->build_object( |
| 219 |
{ |
| 220 |
class => 'Koha::Patrons', |
| 221 |
} |
| 222 |
); |
| 223 |
my $patronid1 = $patron->borrowernumber; |
| 224 |
my $patronid2 = $patron2->borrowernumber; |
| 225 |
|
| 226 |
# Add a fake routing list with fake patrons |
| 227 |
addroutingmember( $patronid1, $subscriptionwithroutinglistid ); |
| 228 |
addroutingmember( $patronid2, $subscriptionwithroutinglistid ); |
| 229 |
|
| 230 |
# Perform SearchSubscriptions |
| 231 |
my $fake_subscription = GetSubscription($subscriptionwithroutinglistid); |
| 232 |
|
| 233 |
my @subscriptionswithroutinglist = SearchSubscriptions( |
| 234 |
{ |
| 235 |
issn => $fake_subscription->{issn}, |
| 236 |
orderby => 'title', |
| 237 |
routinglist => 1 |
| 238 |
} |
| 239 |
); |
| 240 |
|
| 241 |
# Check the results |
| 242 |
is( @subscriptionswithroutinglist, 1, 'SearchSubscriptions returned the expected number of subscriptions' ); |
| 243 |
is( |
| 244 |
$subscriptionswithroutinglist[0]->{title}, $fake_subscription->{title}, |
| 245 |
'SearchSubscriptions returned the correct subscription' |
| 246 |
); |
| 247 |
|
| 202 |
my $frequency = GetSubscriptionFrequency($subscriptioninformation->{periodicity}); |
248 |
my $frequency = GetSubscriptionFrequency($subscriptioninformation->{periodicity}); |
| 203 |
my $old_frequency; |
249 |
my $old_frequency; |
| 204 |
if (not $frequency->{unit}) { |
250 |
if (not $frequency->{unit}) { |
| 205 |
- |
|
|