From bfbe4aa1dcc0fa9101e094218edbf26232a7937c Mon Sep 17 00:00:00 2001 From: Julian Maurice Date: Fri, 20 Jun 2025 11:25:09 +0000 Subject: [PATCH] Bug 29996: Fix tests and add one for Koha::Serial::subscription --- .../Acquisition/OrderFromSubscription.t | 2 +- t/db_dependent/Koha/Acquisition/Booksellers.t | 4 +-- t/db_dependent/Koha/Serial.t | 26 +++++++++++++++++++ t/db_dependent/Letters.t | 4 +-- t/db_dependent/Serials.t | 12 +++++---- t/db_dependent/Serials/Claims.t | 8 +++--- t/db_dependent/Serials/ReNewSubscription.t | 2 +- t/db_dependent/Serials/updateClaim.t | 2 +- t/db_dependent/Serials_2.t | 4 +-- 9 files changed, 46 insertions(+), 18 deletions(-) create mode 100755 t/db_dependent/Koha/Serial.t diff --git a/t/db_dependent/Acquisition/OrderFromSubscription.t b/t/db_dependent/Acquisition/OrderFromSubscription.t index 6df5a18d21..410619067d 100755 --- a/t/db_dependent/Acquisition/OrderFromSubscription.t +++ b/t/db_dependent/Acquisition/OrderFromSubscription.t @@ -55,7 +55,7 @@ my $subscriptionid = NewSubscription( undef, undef, undef, undef, undef, undef, 1, "notes", undef, '2013-01-01', undef, undef, undef, undef, 0, "intnotes", 0, - undef, undef, 0, undef, '2013-12-31', 0 + undef, undef, 0, 0, undef, '2013-12-31', 0 ); die unless $subscriptionid; diff --git a/t/db_dependent/Koha/Acquisition/Booksellers.t b/t/db_dependent/Koha/Acquisition/Booksellers.t index e65e01fcef..f70646f84c 100755 --- a/t/db_dependent/Koha/Acquisition/Booksellers.t +++ b/t/db_dependent/Koha/Acquisition/Booksellers.t @@ -107,7 +107,7 @@ subtest '->subscriptions() tests' => sub { undef, 1, "subscription notes", undef, '2013-01-01', undef, undef, undef, 'CALL ABC', 0, "intnotes", 0, - undef, undef, 0, undef, + undef, undef, 0, 0, undef, '2013-11-30', 0 ); @@ -131,7 +131,7 @@ subtest '->subscriptions() tests' => sub { undef, 1, "subscription notes", undef, '2013-01-01', undef, undef, undef, 'CALL DEF', 0, "intnotes", 0, - undef, undef, 0, undef, + undef, undef, 0, 0, undef, '2013-07-31', 0 ); diff --git a/t/db_dependent/Koha/Serial.t b/t/db_dependent/Koha/Serial.t new file mode 100755 index 0000000000..76649e52fc --- /dev/null +++ b/t/db_dependent/Koha/Serial.t @@ -0,0 +1,26 @@ +#!/usr/bin/perl + +use Modern::Perl; + +use Test::More tests => 1; + +use Koha::Database; +use t::lib::TestBuilder; + +my $schema = Koha::Database->schema; +my $builder = t::lib::TestBuilder->new; + +subtest 'Koha::Serial::subscription' => sub { + plan tests => 2; + + $schema->txn_begin; + + my $serial = $builder->build_object( { class => 'Koha::Serials' } ); + + my $subscription = $serial->subscription; + + isa_ok( $subscription, 'Koha::Subscription' ); + is( $subscription->id, $serial->subscriptionid ); + + $schema->txn_rollback; +}; diff --git a/t/db_dependent/Letters.t b/t/db_dependent/Letters.t index 4edf7c80f5..1dab530428 100755 --- a/t/db_dependent/Letters.t +++ b/t/db_dependent/Letters.t @@ -731,7 +731,7 @@ t::lib::Mocks::mock_preference( 'KohaAdminEmailAddress', 'library@domain.com' ); undef, undef, undef, undef, undef, undef, 1, $notes, undef, '2013-01-01', undef, $number_pattern->id, undef, undef, 0, $internalnotes, 0, - undef, undef, 0, undef, '2013-12-31', 0 + undef, undef, 0, 0, undef, '2013-12-31', 0 ); $dbh->do( q{INSERT INTO letter (module, code, name, title, content) VALUES ('serial','RLIST','Serial issue notification','Serial issue notification','<>,<>,<>');} @@ -864,7 +864,7 @@ subtest 'SendAlerts - claimissue' => sub { undef, undef, undef, undef, undef, undef, 1, 'public', undef, '2013-01-01', undef, $number_pattern->id, undef, undef, 0, 'internal', 0, - undef, undef, 0, undef, '2013-12-31', 0 + undef, undef, 0, 0, undef, '2013-12-31', 0 ); my ( $serials_count, @serials ) = GetSerials($subscriptionid); diff --git a/t/db_dependent/Serials.t b/t/db_dependent/Serials.t index 1e2e5bbff6..f9678b6cfc 100755 --- a/t/db_dependent/Serials.t +++ b/t/db_dependent/Serials.t @@ -127,6 +127,7 @@ my $subscriptionid = NewSubscription( undef, undef, 0, + 0, undef, '2013-12-31', 0, undef, @@ -167,6 +168,7 @@ NewSubscription( undef, undef, 0, + 0, undef, '2013-12-31', 0, @@ -222,7 +224,7 @@ my $subscriptionwithroutinglistid = NewSubscription( undef, undef, undef, undef, undef, undef, 1, $notes, undef, '2013-01-01', undef, $pattern_id, undef, undef, 0, $internalnotes, 0, - undef, undef, 0, undef, '2013-12-31', 0 + undef, undef, 0, 0, undef, '2013-12-31', 0 ); #creating fake patrons @@ -290,7 +292,7 @@ if ( not $frequency->{unit} ) { numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2 innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes letter manualhistory internalnotes serialsadditems staffdisplaycount - opacdisplaycount graceperiod location enddate subscriptionid + opacdisplaycount graceperiod warn_when_late location enddate subscriptionid skip_serialseq itemtype previousitemtype mana_id ccode ) } @@ -358,7 +360,7 @@ if ($old_frequency) { numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2 innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes letter manualhistory internalnotes serialsadditems staffdisplaycount - opacdisplaycount graceperiod location enddate subscriptionid + opacdisplaycount graceperiod warn_when_late location enddate subscriptionid skip_serialseq ) } @@ -669,7 +671,7 @@ subtest "NewSubscription|ModSubscription" => sub { "", "", "", "", "", "", 1, $notes, "", '2013-01-01', "", $pattern_id, "", "", 0, $internalnotes, 0, - "", "", 0, "", '2013-12-31', 0 + "", "", 0, 0, "", '2013-12-31', 0 ); ok( $subscriptionid, "Sending empty string instead of undef to reflect use of the interface" ); @@ -688,7 +690,7 @@ subtest "NewSubscription|ModSubscription" => sub { numberlength weeklength monthlength lastvalue1 innerloop1 lastvalue2 innerloop2 lastvalue3 innerloop3 status biblionumber callnumber notes letter manualhistory internalnotes serialsadditems staffdisplaycount - opacdisplaycount graceperiod location enddate subscriptionid + opacdisplaycount graceperiod warn_when_late location enddate subscriptionid skip_serialseq ) } diff --git a/t/db_dependent/Serials/Claims.t b/t/db_dependent/Serials/Claims.t index 87e197b4cf..ec8ff2d0a7 100755 --- a/t/db_dependent/Serials/Claims.t +++ b/t/db_dependent/Serials/Claims.t @@ -97,7 +97,7 @@ my $subscriptionid_not_late = NewSubscription( undef, undef, undef, undef, undef, undef, 1, "notes", undef, '9999-01-01', undef, undef, undef, undef, 0, "intnotes", 0, - undef, undef, 0, undef, '2013-12-31', 0 + undef, undef, 0, 0, undef, '2013-12-31', 0 ); $supplierlist = GetSuppliersWithLateIssues(); is( scalar(@$supplierlist), 0, 'There is still no late issues yet' ); @@ -108,7 +108,7 @@ my $subscriptionid_inlate1 = NewSubscription( undef, undef, undef, undef, undef, undef, 1, "notes", undef, '2013-01-01', undef, undef, undef, undef, 0, "intnotes", 0, - undef, undef, 0, undef, '2013-12-31', 0 + undef, undef, 0, 0, undef, '2013-12-31', 0 ); my $subscriptionid_inlate2 = NewSubscription( @@ -117,7 +117,7 @@ my $subscriptionid_inlate2 = NewSubscription( undef, undef, undef, undef, undef, undef, 1, "notes", undef, '2013-01-01', undef, undef, undef, undef, 0, "intnotes", 0, - undef, undef, 0, undef, '2013-12-31', 0 + undef, undef, 0, 0, undef, '2013-12-31', 0 ); my $subscriptionid_inlate3 = NewSubscription( @@ -126,7 +126,7 @@ my $subscriptionid_inlate3 = NewSubscription( undef, undef, undef, undef, undef, undef, 1, "notes", undef, '2013-01-02', undef, undef, undef, undef, 0, "intnotes", 0, - undef, undef, 0, undef, '2013-12-31', 0 + undef, undef, 0, 0, undef, '2013-12-31', 0 ); $supplierlist = GetSuppliersWithLateIssues(); diff --git a/t/db_dependent/Serials/ReNewSubscription.t b/t/db_dependent/Serials/ReNewSubscription.t index 720916d142..e315fa72e8 100755 --- a/t/db_dependent/Serials/ReNewSubscription.t +++ b/t/db_dependent/Serials/ReNewSubscription.t @@ -28,7 +28,7 @@ use Test::MockModule; use t::lib::TestBuilder; use t::lib::Mocks; -use C4::Serials qw( NewSubscription ReNewSubscription GetSubscription GetSubscriptionLength ); +use C4::Serials qw( ReNewSubscription GetSubscription GetSubscriptionLength ); use Koha::Database; use Koha::Subscription::Histories; diff --git a/t/db_dependent/Serials/updateClaim.t b/t/db_dependent/Serials/updateClaim.t index 093cee9728..eea01f6ecb 100755 --- a/t/db_dependent/Serials/updateClaim.t +++ b/t/db_dependent/Serials/updateClaim.t @@ -24,7 +24,7 @@ my $subscriptionid_claims = C4::Serials::NewSubscription( undef, undef, undef, undef, undef, undef, 1, "notes", undef, '9999-01-01', undef, undef, undef, undef, 0, "intnotes", 0, - undef, undef, 0, undef, '2013-12-31', 0 + undef, undef, 0, 0, undef, '2013-12-31', 0 ); # Verify and get the serial ID of the subscription diff --git a/t/db_dependent/Serials_2.t b/t/db_dependent/Serials_2.t index 20bae15add..c11aea59bb 100755 --- a/t/db_dependent/Serials_2.t +++ b/t/db_dependent/Serials_2.t @@ -66,7 +66,7 @@ my $subscriptionid_from_my_branch = NewSubscription( undef, undef, undef, undef, undef, undef, 1, "notes", undef, '2013-01-01', undef, undef, undef, undef, 0, "intnotes", 0, - undef, undef, 0, undef, '2013-12-31', 0 + undef, undef, 0, 0, undef, '2013-12-31', 0 ); die unless $subscriptionid_from_my_branch; @@ -76,7 +76,7 @@ my $subscriptionid_from_another_branch = NewSubscription( undef, undef, undef, undef, undef, undef, 1, "notes", undef, '2013-01-01', undef, undef, undef, undef, 0, "intnotes", 0, - undef, undef, 0, undef, '2013-12-31', 0 + undef, undef, 0, 0, undef, '2013-12-31', 0 ); my $subscription_from_my_branch = GetSubscription($subscriptionid_from_my_branch); -- 2.39.5