Bug 7961 - Local cover images should support CSV link files
[koha.git] / t / db_dependent / Serials.t
blob424effc62e240cf0908cba2b0429d2070c61db1d
1 #!/usr/bin/perl
3 # This Koha test module is a stub!
4 # Add more tests here!!!
6 use strict;
7 use warnings;
8 use YAML;
10 use C4::Serials;
11 use C4::Debug;
12 use Test::More tests => 34;
14 BEGIN {
15 use_ok('C4::Serials');
18 my $subscriptionid = 1;
19 my $subscriptioninformation = GetSubscription( $subscriptionid );
20 $debug && warn Dump($subscriptioninformation);
21 my @subscriptions = GetSubscriptions( $$subscriptioninformation{bibliotitle} );
22 isa_ok( \@subscriptions, 'ARRAY' );
23 $debug && warn scalar(@subscriptions);
24 @subscriptions = GetSubscriptions( undef, $$subscriptioninformation{issn} );
25 isa_ok( \@subscriptions, 'ARRAY' );
26 $debug && warn scalar(@subscriptions);
27 @subscriptions = GetSubscriptions( undef, undef, $$subscriptioninformation{ean} );
28 isa_ok( \@subscriptions, 'ARRAY' );
29 $debug && warn scalar(@subscriptions);
30 @subscriptions = GetSubscriptions( undef, undef, undef, $$subscriptioninformation{bibnum} );
31 isa_ok( \@subscriptions, 'ARRAY' );
32 $debug && warn scalar(@subscriptions);
33 if ($subscriptioninformation->{periodicity} % 16==0){
34 $subscriptioninformation->{periodicity}=7;
35 ModSubscription(@$subscriptioninformation{qw(librarian, branchcode, aqbooksellerid, cost, aqbudgetid, startdate, periodicity, firstacquidate,
36 dow, irregularity, numberpattern, numberlength, weeklength, monthlength, add1, every1,
37 whenmorethan1, setto1, lastvalue1, innerloop1, add2, every2, whenmorethan2, setto2,
38 lastvalue2, innerloop2, add3, every3, whenmorethan3, setto3, lastvalue3, innerloop3,
39 numberingmethod, status, biblionumber, callnumber, notes, letter, hemisphere, manualhistory,
40 internalnotes, serialsadditems, staffdisplaycount, opacdisplaycount, graceperiod, location, enddate, subscriptionid
41 )});
43 my $expirationdate = GetExpirationDate(1) ;
44 ok( $expirationdate, "not NULL" );
45 $debug && warn "$expirationdate";
47 is(C4::Serials::GetLateIssues(),"0", 'test getting late issues');
49 ok(C4::Serials::GetSubscriptionHistoryFromSubscriptionId(), 'test getting history from sub-scription');
51 ok(C4::Serials::GetSerialStatusFromSerialId(), 'test getting Serial Status From Serial Id');
53 ok(C4::Serials::GetSerialInformation(), 'test getting Serial Information');
55 ok(C4::Serials::AddItem2Serial(), 'test adding item to serial');
57 ok(C4::Serials::UpdateClaimdateIssues(), 'test updating claim date');
59 ok(C4::Serials::GetFullSubscription(), 'test getting full subscription');
61 ok(C4::Serials::PrepareSerialsData(), 'test preparing serial data');
63 ok(C4::Serials::GetSubscriptionsFromBiblionumber(), 'test getting subscriptions form biblio number');
65 is(C4::Serials::GetSerials(),"0", 'test getting serials when you enter nothing');
66 is(C4::Serials::GetSerials2(),"0", 'test getting serials when you enter nothing');
68 ok(C4::Serials::GetLatestSerials(), 'test getting lastest serials');
70 is(C4::Serials::GetDistributedTo(),"0", 'test getting distributed when nothing is entered');
72 is(C4::Serials::GetNextSeq(),"0", 'test getting next seq when you enter nothing');
74 is(C4::Serials::GetSeq(),undef, 'test getting seq when you enter nothing');
76 is(C4::Serials::CountSubscriptionFromBiblionumber(),"0", 'test counting subscription when nothing is entered');
78 is(C4::Serials::ModSubscriptionHistory(),"0", 'test modding subscription history');
80 is(C4::Serials::ModSerialStatus(),undef, 'test modding serials');
82 is(C4::Serials::NewIssue(),"0", 'test getting 0 when nothing is entered');
84 is(C4::Serials::ItemizeSerials(),undef, 'test getting nothing when nothing is entered');
86 ok(C4::Serials::HasSubscriptionStrictlyExpired(), 'test if the subscriptions has expired');
87 is(C4::Serials::HasSubscriptionExpired(),"0", 'test if the subscriptions has expired');
89 is(C4::Serials::GetLateOrMissingIssues(),"0", 'test getting last or missing issues');
91 is(C4::Serials::removeMissingIssue(),undef, 'test removing a missing issue');
93 is(C4::Serials::updateClaim(),undef, 'test updating claim');
95 is(C4::Serials::getsupplierbyserialid(),undef, 'test getting supplier idea');
97 is(C4::Serials::check_routing(),"0", 'test checking route');
99 is(C4::Serials::addroutingmember(),undef, 'test adding route member');