From 6427906fcccea22327db3c1d78847fed5ba9e7fb Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 31 Jul 2018 15:24:10 -0300 Subject: [PATCH] Bug 21133: [18.05.x] Fix use statements order Basically the idea is: 1. Undefined subroutine &C4::Items::ModZebra called at /home/vagrant/kohaclone/C4/Items.pm line 302. => Then use C4::Items before C4::Biblio 2. Undefined subroutine &C4::Circulation::GetItem called at /home/vagrant/kohaclone/C4/Circulation.pm line 1290 => Then use C4::Circulation before C4::Items And sometimes these 2 rules do not work... Signed-off-by: Martin Renvoize --- t/db_dependent/Circulation/Branch.t | 2 +- t/db_dependent/Circulation/Chargelostitem.t | 2 +- t/db_dependent/Circulation/CheckIfIssuedToPatron.t | 9 +++------ .../Circulation/GetPendingOnSiteCheckouts.t | 2 +- t/db_dependent/Circulation/IsItemIssued.t | 2 +- .../Circulation/IssuingRules/maxsuspensiondays.t | 2 +- t/db_dependent/Circulation/Returns.t | 4 ++-- t/db_dependent/Circulation/SwitchOnSiteCheckouts.t | 4 ++-- t/db_dependent/Circulation/TooMany.t | 4 ++-- t/db_dependent/Circulation/issue.t | 4 ++-- t/db_dependent/Circulation/transfers.t | 4 ++-- t/db_dependent/CourseReserves.t | 4 ++-- t/db_dependent/Holds.t | 9 +++++---- .../Holds/DisallowHoldIfItemsAvailable.t | 2 +- t/db_dependent/Holds/LocalHoldsPriority.t | 2 ++ t/db_dependent/Holds/RevertWaitingStatus.t | 14 ++++++-------- t/db_dependent/Items.t | 9 +++------ .../Items/AutomaticItemModificationByAge.t | 2 +- t/db_dependent/Items/DelItem.t | 7 ++----- t/db_dependent/Koha/Object.t | 3 ++- t/db_dependent/Koha/Patrons.t | 4 +--- t/db_dependent/Labels/t_Batch.t | 2 +- t/db_dependent/Members/GetAllIssues.t | 2 +- t/db_dependent/Members/IssueSlip.t | 2 +- t/db_dependent/Patron/Borrower_Discharge.t | 4 ++-- t/db_dependent/Reserves.t | 2 +- t/db_dependent/RotatingCollections.t | 4 ++-- t/db_dependent/ShelfBrowser.t | 2 +- t/db_dependent/api/v1/holds.t | 2 +- 29 files changed, 53 insertions(+), 62 deletions(-) diff --git a/t/db_dependent/Circulation/Branch.t b/t/db_dependent/Circulation/Branch.t index 1be07d98a3..591902dc5d 100644 --- a/t/db_dependent/Circulation/Branch.t +++ b/t/db_dependent/Circulation/Branch.t @@ -17,10 +17,10 @@ use Modern::Perl; -use C4::Biblio; use C4::Members; use C4::Circulation; use C4::Items; +use C4::Biblio; use C4::Context; use Test::More tests => 14; diff --git a/t/db_dependent/Circulation/Chargelostitem.t b/t/db_dependent/Circulation/Chargelostitem.t index f9b5a3bb35..1df27df14e 100644 --- a/t/db_dependent/Circulation/Chargelostitem.t +++ b/t/db_dependent/Circulation/Chargelostitem.t @@ -7,10 +7,10 @@ use Test::MockModule; use t::lib::Mocks; use t::lib::TestBuilder; +use C4::Circulation; use C4::Biblio; use C4::Items; use C4::Members; -use C4::Circulation; use MARC::Record; BEGIN { diff --git a/t/db_dependent/Circulation/CheckIfIssuedToPatron.t b/t/db_dependent/Circulation/CheckIfIssuedToPatron.t index 4e21c41a87..d51e4bad51 100644 --- a/t/db_dependent/Circulation/CheckIfIssuedToPatron.t +++ b/t/db_dependent/Circulation/CheckIfIssuedToPatron.t @@ -17,21 +17,18 @@ use Modern::Perl; -use Test::More tests => 22; +use Test::More tests => 21; use Test::MockModule; use t::lib::TestBuilder; -use C4::Biblio; +use C4::Circulation; use C4::Items; use C4::Members; +use C4::Biblio; use Koha::Library; use Koha::Patrons; use MARC::Record; -BEGIN { - use_ok('C4::Circulation'); -} - my $schema = Koha::Database->schema; $schema->storage->txn_begin; diff --git a/t/db_dependent/Circulation/GetPendingOnSiteCheckouts.t b/t/db_dependent/Circulation/GetPendingOnSiteCheckouts.t index d47f38ac7c..236626cb70 100644 --- a/t/db_dependent/Circulation/GetPendingOnSiteCheckouts.t +++ b/t/db_dependent/Circulation/GetPendingOnSiteCheckouts.t @@ -21,8 +21,8 @@ use Test::More tests => 2; use Test::MockModule; use t::lib::TestBuilder; -use C4::Biblio; use C4::Circulation; +use C4::Biblio; use C4::Items; use C4::Members; diff --git a/t/db_dependent/Circulation/IsItemIssued.t b/t/db_dependent/Circulation/IsItemIssued.t index 7a30da9409..f4eaa54542 100644 --- a/t/db_dependent/Circulation/IsItemIssued.t +++ b/t/db_dependent/Circulation/IsItemIssued.t @@ -20,10 +20,10 @@ use Modern::Perl; use Test::More tests => 5; use Test::MockModule; -use C4::Biblio; use C4::Circulation; use C4::Items; use C4::Members; +use C4::Biblio; use Koha::Database; use Koha::DateUtils; use Koha::Patrons; diff --git a/t/db_dependent/Circulation/IssuingRules/maxsuspensiondays.t b/t/db_dependent/Circulation/IssuingRules/maxsuspensiondays.t index 70fa799796..8562afa369 100644 --- a/t/db_dependent/Circulation/IssuingRules/maxsuspensiondays.t +++ b/t/db_dependent/Circulation/IssuingRules/maxsuspensiondays.t @@ -5,10 +5,10 @@ use MARC::Record; use MARC::Field; use C4::Context; -use C4::Biblio qw( AddBiblio ); use C4::Circulation qw( AddIssue AddReturn ); use C4::Items qw( AddItem ); use C4::Members qw( AddMember ); +use C4::Biblio qw( AddBiblio ); use Koha::Database; use Koha::DateUtils; use Koha::Patron::Debarments qw( GetDebarments DelDebarment ); diff --git a/t/db_dependent/Circulation/Returns.t b/t/db_dependent/Circulation/Returns.t index 924f5bbd91..bd21347694 100644 --- a/t/db_dependent/Circulation/Returns.t +++ b/t/db_dependent/Circulation/Returns.t @@ -24,10 +24,10 @@ use Test::Warn; use t::lib::Mocks; use t::lib::TestBuilder; -use C4::Biblio; +use C4::Members; use C4::Circulation; use C4::Items; -use C4::Members; +use C4::Biblio; use Koha::Database; use Koha::Account::Lines; use Koha::DateUtils; diff --git a/t/db_dependent/Circulation/SwitchOnSiteCheckouts.t b/t/db_dependent/Circulation/SwitchOnSiteCheckouts.t index f76b17360a..506423d676 100644 --- a/t/db_dependent/Circulation/SwitchOnSiteCheckouts.t +++ b/t/db_dependent/Circulation/SwitchOnSiteCheckouts.t @@ -18,10 +18,10 @@ use Modern::Perl; use Test::More tests => 10; use C4::Context; -use C4::Biblio; -use C4::Members; use C4::Circulation; +use C4::Biblio; use C4::Items; +use C4::Members; use C4::Context; use Koha::DateUtils qw( dt_from_string ); diff --git a/t/db_dependent/Circulation/TooMany.t b/t/db_dependent/Circulation/TooMany.t index 193752ff26..a7f19db8f1 100644 --- a/t/db_dependent/Circulation/TooMany.t +++ b/t/db_dependent/Circulation/TooMany.t @@ -18,10 +18,10 @@ use Modern::Perl; use Test::More tests => 7; use C4::Context; -use C4::Biblio; use C4::Members; -use C4::Circulation; use C4::Items; +use C4::Biblio; +use C4::Circulation; use C4::Context; use Koha::DateUtils qw( dt_from_string ); diff --git a/t/db_dependent/Circulation/issue.t b/t/db_dependent/Circulation/issue.t index 68160dd90b..6086b4bed0 100644 --- a/t/db_dependent/Circulation/issue.t +++ b/t/db_dependent/Circulation/issue.t @@ -23,11 +23,11 @@ use DateTime::Duration; use t::lib::Mocks; use t::lib::TestBuilder; -use C4::Biblio; use C4::Circulation; -use C4::Context; use C4::Items; use C4::Members; +use C4::Biblio; +use C4::Context; use C4::Reserves; use Koha::Checkouts; use Koha::Database; diff --git a/t/db_dependent/Circulation/transfers.t b/t/db_dependent/Circulation/transfers.t index 299c059fff..a377c932cb 100644 --- a/t/db_dependent/Circulation/transfers.t +++ b/t/db_dependent/Circulation/transfers.t @@ -16,10 +16,10 @@ # along with Koha; if not, see . use Modern::Perl; -use C4::Biblio; use C4::Context; -use C4::Items; use C4::Circulation; +use C4::Biblio; +use C4::Items; use Koha::Database; use Koha::DateUtils; use DateTime::Duration; diff --git a/t/db_dependent/CourseReserves.t b/t/db_dependent/CourseReserves.t index 8c47e59c90..2dabc67638 100755 --- a/t/db_dependent/CourseReserves.t +++ b/t/db_dependent/CourseReserves.t @@ -23,10 +23,10 @@ use Koha::Database; use t::lib::TestBuilder; BEGIN { + use_ok('C4::Items', qw(AddItem)); use_ok('C4::Biblio'); - use_ok('C4::Context'); use_ok('C4::CourseReserves', qw/:all/); - use_ok('C4::Items', qw(AddItem)); + use_ok('C4::Context'); use_ok('MARC::Field'); use_ok('MARC::Record'); } diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t index 1e6c234487..c452a58617 100755 --- a/t/db_dependent/Holds.t +++ b/t/db_dependent/Holds.t @@ -7,22 +7,23 @@ use t::lib::TestBuilder; use C4::Context; -use Test::More tests => 55; +use Test::More tests => 54; use MARC::Record; -use C4::Biblio; +use Koha::Patrons; use C4::Items; use C4::Members; +use C4::Biblio; +use C4::Reserves; use C4::Calendar; + use Koha::Database; use Koha::DateUtils qw( dt_from_string output_pref ); use Koha::Biblios; use Koha::Holds; -use Koha::Patrons; BEGIN { use FindBin; use lib $FindBin::Bin; - use_ok('C4::Reserves'); } my $schema = Koha::Database->new->schema; diff --git a/t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t b/t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t index 1a9edd882e..a5237d9aa3 100755 --- a/t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t +++ b/t/db_dependent/Holds/DisallowHoldIfItemsAvailable.t @@ -3,8 +3,8 @@ use Modern::Perl; use C4::Context; -use C4::Items; use C4::Circulation; +use C4::Items; use Koha::IssuingRule; use Test::More tests => 6; diff --git a/t/db_dependent/Holds/LocalHoldsPriority.t b/t/db_dependent/Holds/LocalHoldsPriority.t index 8da4befd72..be47f59128 100755 --- a/t/db_dependent/Holds/LocalHoldsPriority.t +++ b/t/db_dependent/Holds/LocalHoldsPriority.t @@ -7,6 +7,8 @@ use C4::Context; use Test::More tests => 6; use MARC::Record; + +use Koha::Patrons; use C4::Biblio; use C4::Items; use C4::Members; diff --git a/t/db_dependent/Holds/RevertWaitingStatus.t b/t/db_dependent/Holds/RevertWaitingStatus.t index ae7fdaa8dd..2d00f23448 100755 --- a/t/db_dependent/Holds/RevertWaitingStatus.t +++ b/t/db_dependent/Holds/RevertWaitingStatus.t @@ -16,21 +16,19 @@ # along with Koha; if not, see . use Modern::Perl; - -use t::lib::Mocks; -use C4::Context; - use Test::More tests => 3; use MARC::Record; -use C4::Biblio; -use C4::Items; -use C4::Members; -use C4::Reserves; use Koha::Libraries; use Koha::Patrons; +use C4::Context; +use C4::Items; +use C4::Biblio; +use C4::Members; +use C4::Reserves; use t::lib::TestBuilder; +use t::lib::Mocks; my $schema = Koha::Database->schema; $schema->storage->txn_begin; diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t index ef098734c9..92151d662d 100755 --- a/t/db_dependent/Items.t +++ b/t/db_dependent/Items.t @@ -20,7 +20,9 @@ use Modern::Perl; use Data::Dumper; use MARC::Record; +use C4::Items; use C4::Biblio; +use Koha::Items; use Koha::Database; use Koha::DateUtils qw( dt_from_string ); use Koha::Library; @@ -31,15 +33,10 @@ use Koha::Caches; use t::lib::Mocks; use t::lib::TestBuilder; -use Test::More tests => 14; +use Test::More tests => 12; use Test::Warn; -BEGIN { - use_ok('C4::Items'); - use_ok('Koha::Items'); -} - my $schema = Koha::Database->new->schema; my $location = 'My Location'; diff --git a/t/db_dependent/Items/AutomaticItemModificationByAge.t b/t/db_dependent/Items/AutomaticItemModificationByAge.t index b93c62681c..17172be5d2 100644 --- a/t/db_dependent/Items/AutomaticItemModificationByAge.t +++ b/t/db_dependent/Items/AutomaticItemModificationByAge.t @@ -7,9 +7,9 @@ use MARC::Field; use DateTime; use DateTime::Duration; +use C4::Items; use C4::Biblio; use C4::Context; -use C4::Items; use Koha::DateUtils; use t::lib::TestBuilder; diff --git a/t/db_dependent/Items/DelItem.t b/t/db_dependent/Items/DelItem.t index 2880f11b03..03f1f5840e 100644 --- a/t/db_dependent/Items/DelItem.t +++ b/t/db_dependent/Items/DelItem.t @@ -1,15 +1,12 @@ use Modern::Perl; use MARC::Record; +use C4::Items; use C4::Biblio; use t::lib::TestBuilder; -use Test::More tests => 7; - -BEGIN { - use_ok('C4::Items'); -} +use Test::More tests => 6; my $schema = Koha::Database->schema; $schema->storage->txn_begin; diff --git a/t/db_dependent/Koha/Object.t b/t/db_dependent/Koha/Object.t index a00083a5b7..45cd84decb 100755 --- a/t/db_dependent/Koha/Object.t +++ b/t/db_dependent/Koha/Object.t @@ -23,9 +23,10 @@ use Test::Warn; use DateTime; use C4::Context; -use C4::Biblio; # AddBiblio use C4::Circulation; # AddIssue use C4::Members;# AddMember +use C4::Biblio; # AddBiblio + use Koha::Database; use Koha::DateUtils qw( dt_from_string ); use Koha::Libraries; diff --git a/t/db_dependent/Koha/Patrons.t b/t/db_dependent/Koha/Patrons.t index 4c83ee4f00..82d0920ecd 100644 --- a/t/db_dependent/Koha/Patrons.t +++ b/t/db_dependent/Koha/Patrons.t @@ -25,11 +25,9 @@ use Time::Fake; use DateTime; use JSON; -use C4::Biblio; -use C4::Circulation; - use C4::Members; use C4::Circulation; +use C4::Biblio; use Koha::Holds; use Koha::Patron; diff --git a/t/db_dependent/Labels/t_Batch.t b/t/db_dependent/Labels/t_Batch.t index ed8c8e84b1..49929464df 100644 --- a/t/db_dependent/Labels/t_Batch.t +++ b/t/db_dependent/Labels/t_Batch.t @@ -27,8 +27,8 @@ use MARC::Field; use t::lib::TestBuilder; use C4::Context; -use C4::Biblio; use C4::Items; +use C4::Biblio; use Koha::Libraries; BEGIN { diff --git a/t/db_dependent/Members/GetAllIssues.t b/t/db_dependent/Members/GetAllIssues.t index 643320169c..bf17f6a03d 100644 --- a/t/db_dependent/Members/GetAllIssues.t +++ b/t/db_dependent/Members/GetAllIssues.t @@ -22,10 +22,10 @@ use Test::MockModule; use t::lib::TestBuilder; +use C4::Circulation; use C4::Biblio; use C4::Items; use C4::Members; -use C4::Circulation; use Koha::Libraries; use Koha::Patrons; use MARC::Record; diff --git a/t/db_dependent/Members/IssueSlip.t b/t/db_dependent/Members/IssueSlip.t index d34faac6bf..9fa112fa32 100644 --- a/t/db_dependent/Members/IssueSlip.t +++ b/t/db_dependent/Members/IssueSlip.t @@ -24,10 +24,10 @@ use Test::MockModule; use Test::MockTime qw( set_fixed_time ); use t::lib::TestBuilder; +use C4::Circulation; use C4::Biblio; use C4::Items; use C4::Members; -use C4::Circulation; use Koha::DateUtils qw( dt_from_string output_pref ); use Koha::Library; diff --git a/t/db_dependent/Patron/Borrower_Discharge.t b/t/db_dependent/Patron/Borrower_Discharge.t index cf08a88308..35806a1ffa 100644 --- a/t/db_dependent/Patron/Borrower_Discharge.t +++ b/t/db_dependent/Patron/Borrower_Discharge.t @@ -19,11 +19,11 @@ use Test::More tests => 19; use Test::Warn; use MARC::Record; -use C4::Biblio qw( AddBiblio ); use C4::Circulation qw( AddIssue AddReturn ); -use C4::Context; use C4::Items qw( AddItem ); use C4::Members qw( AddMember ); +use C4::Biblio qw( AddBiblio ); +use C4::Context; use Koha::Patron::Discharge; use Koha::Database; diff --git a/t/db_dependent/Reserves.t b/t/db_dependent/Reserves.t index b5aa9278d0..7d2c91fd68 100755 --- a/t/db_dependent/Reserves.t +++ b/t/db_dependent/Reserves.t @@ -27,9 +27,9 @@ use t::lib::TestBuilder; use MARC::Record; use DateTime::Duration; -use C4::Biblio; use C4::Circulation; use C4::Items; +use C4::Biblio; use C4::Members; use C4::Reserves; use Koha::Caches; diff --git a/t/db_dependent/RotatingCollections.t b/t/db_dependent/RotatingCollections.t index 9c46b33619..e00410c729 100644 --- a/t/db_dependent/RotatingCollections.t +++ b/t/db_dependent/RotatingCollections.t @@ -17,13 +17,13 @@ use Modern::Perl; -use Test::More tests => 52; +use Test::More tests => 51; use C4::Context; +use C4::RotatingCollections; use C4::Biblio; use Koha::Library; BEGIN { - use_ok('C4::RotatingCollections'); } can_ok( diff --git a/t/db_dependent/ShelfBrowser.t b/t/db_dependent/ShelfBrowser.t index de01139fba..f4dd9b9d78 100644 --- a/t/db_dependent/ShelfBrowser.t +++ b/t/db_dependent/ShelfBrowser.t @@ -6,9 +6,9 @@ use List::Util qw( shuffle ); use MARC::Field; use MARC::Record; -use C4::Biblio; use C4::Context; use C4::Items; +use C4::Biblio; use Koha::Database; use t::lib::TestBuilder; diff --git a/t/db_dependent/api/v1/holds.t b/t/db_dependent/api/v1/holds.t index b3e3678c0c..1e00be1a3b 100644 --- a/t/db_dependent/api/v1/holds.t +++ b/t/db_dependent/api/v1/holds.t @@ -25,6 +25,7 @@ use t::lib::Mocks; use DateTime; use C4::Context; +use Koha::Patrons; use C4::Reserves; use C4::Items; @@ -33,7 +34,6 @@ use Koha::DateUtils; use Koha::Biblios; use Koha::Biblioitems; use Koha::Items; -use Koha::Patrons; my $schema = Koha::Database->new->schema; my $builder = t::lib::TestBuilder->new(); -- 2.39.5