|
Lines 15-21
use C4::Bookseller;
Link Here
|
| 15 |
use C4::Biblio; |
15 |
use C4::Biblio; |
| 16 |
use C4::Budgets; |
16 |
use C4::Budgets; |
| 17 |
use Koha::DateUtils; |
17 |
use Koha::DateUtils; |
| 18 |
use Test::More tests => 43; |
18 |
use Test::More tests => 45; |
| 19 |
|
19 |
|
| 20 |
BEGIN { |
20 |
BEGIN { |
| 21 |
use_ok('C4::Serials'); |
21 |
use_ok('C4::Serials'); |
|
Lines 27-32
my $dbh = C4::Context->dbh;
Link Here
|
| 27 |
$dbh->{AutoCommit} = 0; |
27 |
$dbh->{AutoCommit} = 0; |
| 28 |
$dbh->{RaiseError} = 1; |
28 |
$dbh->{RaiseError} = 1; |
| 29 |
|
29 |
|
|
|
30 |
# This could/should be used for all untested methods |
| 31 |
my @methods = ('updateClaim'); |
| 32 |
can_ok('C4::Serials', @methods); |
| 33 |
|
| 30 |
my $booksellerid = C4::Bookseller::AddBookseller( |
34 |
my $booksellerid = C4::Bookseller::AddBookseller( |
| 31 |
{ |
35 |
{ |
| 32 |
name => "my vendor", |
36 |
name => "my vendor", |
|
Lines 179-184
is(C4::Serials::HasSubscriptionExpired(), undef, 'test if the subscriptions has
Link Here
|
| 179 |
|
183 |
|
| 180 |
is(C4::Serials::GetLateOrMissingIssues(), undef, 'test getting last or missing issues'); |
184 |
is(C4::Serials::GetLateOrMissingIssues(), undef, 'test getting last or missing issues'); |
| 181 |
|
185 |
|
|
|
186 |
subtest 'test_updateClaim' => sub { |
| 187 |
plan tests => 11; |
| 188 |
|
| 189 |
# Given ... nothing much |
| 190 |
# When ... Then ... |
| 191 |
my $result_0 = C4::Serials::updateClaim(undef); |
| 192 |
is($result_0, undef, 'Got the expected undef from update claim with nothin'); |
| 193 |
|
| 194 |
# Given ... 3 serial. 2 of them updated. |
| 195 |
my $serialids_1 = [90980, 90981]; |
| 196 |
my $claimdate_1 = '2001/01/13'; # arbitrary date some time in the past. |
| 197 |
my $claim_count_1 = 5; |
| 198 |
Koha::Serial->new( { serialid => $serialids_1->[0], serialseq => 'serialseq', subscriptionid => $subscriptionid, status => 3, |
| 199 |
biblionumber => 12345, claimdate => $claimdate_1, claims_count => $claim_count_1, } )->store(); |
| 200 |
Koha::Serial->new( { serialid => $serialids_1->[1], serialseq => 'serialseq', subscriptionid => $subscriptionid, status => 3, |
| 201 |
biblionumber => 12345, claimdate => $claimdate_1, claims_count => $claim_count_1, } )->store(); |
| 202 |
Koha::Serial->new( { serialid => 90982, serialseq => 'serialseq', subscriptionid => $subscriptionid, status => 3, |
| 203 |
biblionumber => 12345, claimdate => $claimdate_1, claims_count => $claim_count_1, } )->store(); |
| 204 |
|
| 205 |
# When ... |
| 206 |
my $result_1 = C4::Serials::updateClaim($serialids_1); |
| 207 |
|
| 208 |
# Then ... |
| 209 |
is($result_1, 2, 'Got the expected 2 from update claim with 2 serial ids'); |
| 210 |
|
| 211 |
my @late_or_missing_issues_1_0 = C4::Serials::GetLateOrMissingIssues(undef, $serialids_1->[0]); |
| 212 |
isnt($late_or_missing_issues_1_0[0]->{claimdate}, $claimdate_1, 'Got the expected first different claim date from update claim'); |
| 213 |
is($late_or_missing_issues_1_0[0]->{claims_count}, $claim_count_1+1, 'Got the expected first claim count from update claim'); |
| 214 |
is($late_or_missing_issues_1_0[0]->{status}, 7, 'Got the expected first claim status from update claim'); |
| 215 |
|
| 216 |
my @late_or_missing_issues_1_1 = C4::Serials::GetLateOrMissingIssues(undef, $serialids_1->[1]); |
| 217 |
isnt($late_or_missing_issues_1_1[0]->{claimdate}, $claimdate_1, 'Got the expected second different claim date from update claim'); |
| 218 |
is($late_or_missing_issues_1_1[0]->{claims_count}, $claim_count_1+1, 'Got the expected second claim count from update claim'); |
| 219 |
is($late_or_missing_issues_1_1[0]->{status}, 7, 'Got the expected second claim status from update claim'); |
| 220 |
|
| 221 |
my @late_or_missing_issues_1_2 = C4::Serials::GetLateOrMissingIssues(undef, 90982); |
| 222 |
is($late_or_missing_issues_1_2[0]->{claimdate}, '13/01/2001', 'Got the expected unchanged claim date from update claim'); |
| 223 |
is($late_or_missing_issues_1_2[0]->{claims_count}, $claim_count_1, 'Got the expected unchanged claim count from update claim'); |
| 224 |
is($late_or_missing_issues_1_2[0]->{status}, 3, 'Got the expected unchanged claim status from update claim'); |
| 225 |
}; |
| 226 |
|
| 182 |
is(C4::Serials::getsupplierbyserialid(),undef, 'test getting supplier idea'); |
227 |
is(C4::Serials::getsupplierbyserialid(),undef, 'test getting supplier idea'); |
| 183 |
|
228 |
|
| 184 |
is(C4::Serials::check_routing(), undef, 'test checking route'); |
229 |
is(C4::Serials::check_routing(), undef, 'test checking route'); |
| 185 |
- |
|
|