|
Lines 16-22
use Koha::DateUtils qw( dt_from_string output_pref );
Link Here
|
| 16 |
use Koha::Acquisition::Booksellers; |
16 |
use Koha::Acquisition::Booksellers; |
| 17 |
use t::lib::Mocks; |
17 |
use t::lib::Mocks; |
| 18 |
use t::lib::TestBuilder; |
18 |
use t::lib::TestBuilder; |
| 19 |
use Test::More tests => 52; |
19 |
use Test::More tests => 54; |
| 20 |
|
20 |
|
| 21 |
BEGIN { |
21 |
BEGIN { |
| 22 |
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 )); |
22 |
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 26-31
my $schema = Koha::Database->new->schema;
Link Here
|
| 26 |
$schema->storage->txn_begin; |
26 |
$schema->storage->txn_begin; |
| 27 |
my $dbh = C4::Context->dbh; |
27 |
my $dbh = C4::Context->dbh; |
| 28 |
|
28 |
|
|
|
29 |
$dbh->do('DELETE FROM subscription'); |
| 30 |
|
| 29 |
my $builder = t::lib::TestBuilder->new(); |
31 |
my $builder = t::lib::TestBuilder->new(); |
| 30 |
|
32 |
|
| 31 |
# This could/should be used for all untested methods |
33 |
# This could/should be used for all untested methods |
|
Lines 76-89
my $notes = "a\nnote\non\nseveral\nlines";
Link Here
|
| 76 |
my $internalnotes = 'intnotes'; |
78 |
my $internalnotes = 'intnotes'; |
| 77 |
my $ccode = 'FIC'; |
79 |
my $ccode = 'FIC'; |
| 78 |
my $subscriptionid = NewSubscription( |
80 |
my $subscriptionid = NewSubscription( |
| 79 |
undef, "", undef, undef, $budget_id, $biblionumber, |
81 |
undef, |
| 80 |
'2013-01-01', $frequency_id, undef, undef, undef, |
82 |
"", |
| 81 |
undef, undef, undef, undef, undef, undef, |
83 |
undef, |
| 82 |
1, $notes, ,undef, '2013-01-01', undef, $pattern_id, |
84 |
undef, |
| 83 |
undef, undef, 0, $internalnotes, 0, |
85 |
$budget_id, |
| 84 |
undef, undef, 0, undef, '2013-12-31', 0, |
86 |
$biblionumber, |
| 85 |
undef, undef, undef, $ccode |
87 |
'2013-01-01', |
|
|
88 |
$frequency_id, |
| 89 |
undef, |
| 90 |
undef, |
| 91 |
undef, |
| 92 |
undef, |
| 93 |
undef, |
| 94 |
undef, |
| 95 |
undef, |
| 96 |
undef, |
| 97 |
undef, |
| 98 |
1, |
| 99 |
$notes, |
| 100 |
undef, |
| 101 |
'2013-01-01', |
| 102 |
undef, |
| 103 |
$pattern_id, |
| 104 |
undef, |
| 105 |
undef, |
| 106 |
0, |
| 107 |
$internalnotes, |
| 108 |
0, |
| 109 |
undef, |
| 110 |
undef, |
| 111 |
0, |
| 112 |
undef, |
| 113 |
'2013-12-31', 0, |
| 114 |
undef, |
| 115 |
undef, |
| 116 |
undef, |
| 117 |
$ccode |
| 118 |
); |
| 86 |
|
119 |
|
|
|
120 |
NewSubscription( |
| 121 |
undef, |
| 122 |
"", |
| 123 |
undef, |
| 124 |
undef, |
| 125 |
$budget_id, |
| 126 |
$biblionumber, |
| 127 |
'2013-01-02', |
| 128 |
$frequency_id, |
| 129 |
undef, |
| 130 |
undef, |
| 131 |
undef, |
| 132 |
undef, |
| 133 |
undef, |
| 134 |
undef, |
| 135 |
undef, |
| 136 |
undef, |
| 137 |
undef, |
| 138 |
1, |
| 139 |
$notes, |
| 140 |
undef, |
| 141 |
'2013-01-02', |
| 142 |
undef, |
| 143 |
$pattern_id, |
| 144 |
undef, |
| 145 |
undef, |
| 146 |
0, |
| 147 |
$internalnotes, |
| 148 |
0, |
| 149 |
undef, |
| 150 |
undef, |
| 151 |
0, |
| 152 |
undef, |
| 153 |
'2013-12-31', |
| 154 |
0, |
| 155 |
undef, |
| 156 |
undef, |
| 157 |
undef, |
| 158 |
$ccode |
| 87 |
); |
159 |
); |
| 88 |
|
160 |
|
| 89 |
my $subscriptioninformation = GetSubscription( $subscriptionid ); |
161 |
my $subscriptioninformation = GetSubscription( $subscriptionid ); |
|
Lines 108-113
isa_ok( \@subscriptions, 'ARRAY' );
Link Here
|
| 108 |
@subscriptions = SearchSubscriptions({ biblionumber => $subscriptioninformation->{bibnum}, orderby => 'title' }); |
180 |
@subscriptions = SearchSubscriptions({ biblionumber => $subscriptioninformation->{bibnum}, orderby => 'title' }); |
| 109 |
isa_ok( \@subscriptions, 'ARRAY' ); |
181 |
isa_ok( \@subscriptions, 'ARRAY' ); |
| 110 |
|
182 |
|
|
|
183 |
@subscriptions = SearchSubscriptions({}); |
| 184 |
is( |
| 185 |
@subscriptions, |
| 186 |
2, |
| 187 |
'SearchSubscriptions returned the expected number of subscriptions when results_limit is not set' |
| 188 |
); |
| 189 |
|
| 190 |
@subscriptions = SearchSubscriptions({}, { results_limit => 1 }); |
| 191 |
is( |
| 192 |
@subscriptions, |
| 193 |
1, |
| 194 |
'SearchSubscriptions returned only one subscription when results_limit is set to "1"' |
| 195 |
); |
| 196 |
|
| 111 |
my $frequency = GetSubscriptionFrequency($subscriptioninformation->{periodicity}); |
197 |
my $frequency = GetSubscriptionFrequency($subscriptioninformation->{periodicity}); |
| 112 |
my $old_frequency; |
198 |
my $old_frequency; |
| 113 |
if (not $frequency->{unit}) { |
199 |
if (not $frequency->{unit}) { |
| 114 |
- |
|
|