View | Details | Raw Unified | Return to bug 12178
Collapse All | Expand All

(-)a/t/db_dependent/Serials.t (-2 / +46 lines)
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 => 46;
18
use Test::More tests => 48;
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 181-186 is(C4::Serials::HasSubscriptionExpired(), undef, 'test if the subscriptions has Link Here
181
185
182
is(C4::Serials::GetLateOrMissingIssues(), undef, 'test getting last or missing issues');
186
is(C4::Serials::GetLateOrMissingIssues(), undef, 'test getting last or missing issues');
183
187
188
subtest 'test_updateClaim' => sub {
189
    plan tests => 11;
190
191
    # Given ... nothing much
192
    # When ... Then ...
193
    my $result_0 = C4::Serials::updateClaim(undef);
194
    is($result_0, undef, 'Got the expected undef from update claim with nothin');
195
196
    # Given ... 3 serial. 2 of them updated.
197
    my $serialids_1   = [90980, 90981];
198
    my $claimdate_1   = '2001/01/13'; # arbitrary date some time in the past.
199
    my $claim_count_1 = 5;
200
    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();
202
    Koha::Serial->new( { serialid => $serialids_1->[1], serialseq => 'serialseq', subscriptionid => $subscriptionid, status => 3,
203
                         biblionumber => 12345, claimdate => $claimdate_1, claims_count => $claim_count_1,  } )->store();
204
    Koha::Serial->new( { serialid => 90982, serialseq => 'serialseq', subscriptionid => $subscriptionid, status => 3,
205
                         biblionumber => 12345, claimdate => $claimdate_1, claims_count => $claim_count_1,  } )->store();
206
207
    # When ...
208
    my $result_1 = C4::Serials::updateClaim($serialids_1);
209
210
    # Then ...
211
    is($result_1, 2, 'Got the expected 2 from update claim with 2 serial ids');
212
213
    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');
215
    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');
217
218
    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');
220
    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');
222
223
    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');
225
    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');
227
};
228
184
is(C4::Serials::getsupplierbyserialid(),undef, 'test getting supplier idea');
229
is(C4::Serials::getsupplierbyserialid(),undef, 'test getting supplier idea');
185
230
186
is(C4::Serials::check_routing(), undef, 'test checking route');
231
is(C4::Serials::check_routing(), undef, 'test checking route');
187
- 

Return to bug 12178