|
Lines 15-20
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 t::lib::Mocks; |
| 18 |
use Test::More tests => 48; |
19 |
use Test::More tests => 48; |
| 19 |
|
20 |
|
| 20 |
BEGIN { |
21 |
BEGIN { |
|
Lines 188-193
is(C4::Serials::GetLateOrMissingIssues(), undef, 'test getting last or missing i
Link Here
|
| 188 |
subtest 'test_updateClaim' => sub { |
189 |
subtest 'test_updateClaim' => sub { |
| 189 |
plan tests => 11; |
190 |
plan tests => 11; |
| 190 |
|
191 |
|
|
|
192 |
my $today = output_pref({ dt => dt_from_string, dateonly => 1 }); |
| 191 |
# Given ... nothing much |
193 |
# Given ... nothing much |
| 192 |
# When ... Then ... |
194 |
# When ... Then ... |
| 193 |
my $result_0 = C4::Serials::updateClaim(undef); |
195 |
my $result_0 = C4::Serials::updateClaim(undef); |
|
Lines 195-201
subtest 'test_updateClaim' => sub {
Link Here
|
| 195 |
|
197 |
|
| 196 |
# Given ... 3 serial. 2 of them updated. |
198 |
# Given ... 3 serial. 2 of them updated. |
| 197 |
my $serialids_1 = [90980, 90981]; |
199 |
my $serialids_1 = [90980, 90981]; |
| 198 |
my $claimdate_1 = '2001/01/13'; # arbitrary date some time in the past. |
200 |
my $claimdate_1 = dt_from_string('2001-01-13'); # arbitrary date some time in the past. |
| 199 |
my $claim_count_1 = 5; |
201 |
my $claim_count_1 = 5; |
| 200 |
Koha::Serial->new( { serialid => $serialids_1->[0], serialseq => 'serialseq', subscriptionid => $subscriptionid, status => 3, |
202 |
Koha::Serial->new( { serialid => $serialids_1->[0], serialseq => 'serialseq', subscriptionid => $subscriptionid, status => 3, |
| 201 |
biblionumber => 12345, claimdate => $claimdate_1, claims_count => $claim_count_1, } )->store(); |
203 |
biblionumber => 12345, claimdate => $claimdate_1, claims_count => $claim_count_1, } )->store(); |
|
Lines 211-227
subtest 'test_updateClaim' => sub {
Link Here
|
| 211 |
is($result_1, 2, 'Got the expected 2 from update claim with 2 serial ids'); |
213 |
is($result_1, 2, 'Got the expected 2 from update claim with 2 serial ids'); |
| 212 |
|
214 |
|
| 213 |
my @late_or_missing_issues_1_0 = C4::Serials::GetLateOrMissingIssues(undef, $serialids_1->[0]); |
215 |
my @late_or_missing_issues_1_0 = C4::Serials::GetLateOrMissingIssues(undef, $serialids_1->[0]); |
| 214 |
isnt($late_or_missing_issues_1_0[0]->{claimdate}, $claimdate_1, 'Got the expected first different claim date from update claim'); |
216 |
is($late_or_missing_issues_1_0[0]->{claimdate}, $today, 'Got the expected first different claim date from update claim'); |
| 215 |
is($late_or_missing_issues_1_0[0]->{claims_count}, $claim_count_1+1, 'Got the expected first claim count from update claim'); |
217 |
is($late_or_missing_issues_1_0[0]->{claims_count}, $claim_count_1+1, 'Got the expected first claim count from update claim'); |
| 216 |
is($late_or_missing_issues_1_0[0]->{status}, 7, 'Got the expected first claim status from update claim'); |
218 |
is($late_or_missing_issues_1_0[0]->{status}, 7, 'Got the expected first claim status from update claim'); |
| 217 |
|
219 |
|
| 218 |
my @late_or_missing_issues_1_1 = C4::Serials::GetLateOrMissingIssues(undef, $serialids_1->[1]); |
220 |
my @late_or_missing_issues_1_1 = C4::Serials::GetLateOrMissingIssues(undef, $serialids_1->[1]); |
| 219 |
isnt($late_or_missing_issues_1_1[0]->{claimdate}, $claimdate_1, 'Got the expected second different claim date from update claim'); |
221 |
is($late_or_missing_issues_1_1[0]->{claimdate}, $today, 'Got the expected second different claim date from update claim'); |
| 220 |
is($late_or_missing_issues_1_1[0]->{claims_count}, $claim_count_1+1, 'Got the expected second claim count from update claim'); |
222 |
is($late_or_missing_issues_1_1[0]->{claims_count}, $claim_count_1+1, 'Got the expected second claim count from update claim'); |
| 221 |
is($late_or_missing_issues_1_1[0]->{status}, 7, 'Got the expected second claim status from update claim'); |
223 |
is($late_or_missing_issues_1_1[0]->{status}, 7, 'Got the expected second claim status from update claim'); |
| 222 |
|
224 |
|
| 223 |
my @late_or_missing_issues_1_2 = C4::Serials::GetLateOrMissingIssues(undef, 90982); |
225 |
my @late_or_missing_issues_1_2 = C4::Serials::GetLateOrMissingIssues(undef, 90982); |
| 224 |
is($late_or_missing_issues_1_2[0]->{claimdate}, '13/01/2001', 'Got the expected unchanged claim date from update claim'); |
226 |
is($late_or_missing_issues_1_2[0]->{claimdate}, output_pref({ dt => $claimdate_1, dateonly => 1}), 'Got the expected unchanged claim date from update claim'); |
| 225 |
is($late_or_missing_issues_1_2[0]->{claims_count}, $claim_count_1, 'Got the expected unchanged claim count from update claim'); |
227 |
is($late_or_missing_issues_1_2[0]->{claims_count}, $claim_count_1, 'Got the expected unchanged claim count from update claim'); |
| 226 |
is($late_or_missing_issues_1_2[0]->{status}, 3, 'Got the expected unchanged claim status from update claim'); |
228 |
is($late_or_missing_issues_1_2[0]->{status}, 3, 'Got the expected unchanged claim status from update claim'); |
| 227 |
}; |
229 |
}; |
| 228 |
- |
|
|