Bug 40680: Fix t tests

Amended patch
@ t/db_dependent/Realtime_holdsqueue.t:26 @ use Test::MockModule;
-use C4::SIP::ILS::Transaction::Checkin qw( do_checkin );
+use C4::SIP::ILS::Transaction::Checkin;

Signed-off-by: Victor Grousset/tuxayo <victor@tuxayo.net>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Jonathan Druart 2025-10-03 15:26:08 +02:00 committed by Lucas Gass
parent 41341ecccc
commit d3577b9277
No known key found for this signature in database
GPG Key ID: 60B447398B0D36CA
39 changed files with 49 additions and 58 deletions

View File

@ -16,7 +16,7 @@ use MARC::Record;
use C4::AuthoritiesMarc qw( FindDuplicateAuthority ); use C4::AuthoritiesMarc qw( FindDuplicateAuthority );
BEGIN { BEGIN {
use_ok( 'C4::AuthoritiesMarc::MARC21', qw( default_auth_type_location fix_marc21_auth_type_location ) ); use_ok('C4::AuthoritiesMarc::MARC21');
} }
my @result = C4::AuthoritiesMarc::MARC21::default_auth_type_location(); my @result = C4::AuthoritiesMarc::MARC21::default_auth_type_location();

View File

@ -10,7 +10,7 @@ use Test::NoWarnings;
use Test::More tests => 3; use Test::More tests => 3;
BEGIN { BEGIN {
use_ok( 'C4::AuthoritiesMarc::UNIMARC', qw( default_auth_type_location ) ); use_ok('C4::AuthoritiesMarc::UNIMARC');
} }
my @test = C4::AuthoritiesMarc::UNIMARC::default_auth_type_location(); my @test = C4::AuthoritiesMarc::UNIMARC::default_auth_type_location();

View File

@ -10,7 +10,7 @@ use Test::NoWarnings;
use Test::More tests => 11; use Test::More tests => 11;
BEGIN { BEGIN {
use_ok( 'C4::ClassSortRoutine::Dewey', qw( get_class_sort_key ) ); use_ok('C4::ClassSortRoutine::Dewey');
} }
my $cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key( undef, undef ); my $cn_sort = C4::ClassSortRoutine::Dewey::get_class_sort_key( undef, undef );

View File

@ -10,7 +10,7 @@ use Test::NoWarnings;
use Test::More tests => 4; use Test::More tests => 4;
BEGIN { BEGIN {
use_ok( 'C4::ClassSortRoutine::Generic', qw( get_class_sort_key ) ); use_ok('C4::ClassSortRoutine::Generic');
} }
my $cn_class = "My class "; my $cn_class = "My class ";

View File

@ -10,7 +10,7 @@ use Test::NoWarnings;
use Test::More tests => 11; use Test::More tests => 11;
BEGIN { BEGIN {
use_ok( 'C4::ClassSortRoutine::LCC', qw( get_class_sort_key ) ); use_ok('C4::ClassSortRoutine::LCC');
} }
#Obvious cases #Obvious cases

View File

@ -19,7 +19,7 @@ use Test::More tests => 42;
BEGIN { BEGIN {
use_ok('C4::Creators'); use_ok('C4::Creators');
use_ok( 'C4::Creators::PDF', qw( Init Add Bookmark Compress Font FontSize Page StrWidth Text End ) ); use_ok('C4::Creators::PDF');
} }
my $pdf_creator = C4::Creators::PDF->new( InitVars => 0 ); my $pdf_creator = C4::Creators::PDF->new( InitVars => 0 );

View File

@ -24,7 +24,7 @@ use Test::More tests => 12;
use Test::NoWarnings; use Test::NoWarnings;
BEGIN { BEGIN {
use_ok( 'C4::Labels::Label', qw( _get_text_fields _check_params _guide_box ) ); use_ok('C4::Labels::Label');
} }
my $format_string = "title, callnumber"; my $format_string = "title, callnumber";

View File

@ -19,7 +19,7 @@ use Modern::Perl;
use Test::NoWarnings; use Test::NoWarnings;
use Test::More tests => 6; use Test::More tests => 6;
use C4::ClassSplitRoutine::RegEx qw( split_callnumber ); use C4::ClassSplitRoutine::RegEx;
my $callnumbers = { my $callnumbers = {
'830 Han' => [qw{830 Han}], '830 Han' => [qw{830 Han}],

View File

@ -41,7 +41,7 @@ BEGIN {
$test_num += 4; $test_num += 4;
} }
plan tests => $test_num + 1; plan tests => $test_num + 1;
use_ok( 'C4::ClassSplitRoutine::Dewey', qw( split_callnumber ) ); use_ok('C4::ClassSplitRoutine::Dewey');
use vars qw($ddcns); use vars qw($ddcns);
} }

View File

@ -23,7 +23,7 @@ use Test::NoWarnings;
use Test::More tests => 9; use Test::More tests => 9;
BEGIN { BEGIN {
use_ok( 'C4::SMS', qw( driver send_sms ) ); use_ok('C4::SMS');
} }
my $driver = 'my mock driver'; my $driver = 'my mock driver';

View File

@ -8,8 +8,8 @@ use URI::Escape;
use JSON qw( decode_json ); use JSON qw( decode_json );
use_ok('Koha::DateUtils'); use_ok('Koha::DateUtils');
use_ok( 'C4::Search::History', qw( get get_from_session set_to_session delete ) ); use_ok('C4::Search::History');
use_ok( 'C4::Auth', qw/get_session/ ); use_ok( 'C4::Auth', qw/get_session/ );
# Test session # Test session
my $expected_recent_searches = [ my $expected_recent_searches = [

View File

@ -30,7 +30,7 @@ $| = 1;
BEGIN { BEGIN {
use FindBin; use FindBin;
use lib $FindBin::Bin; use lib $FindBin::Bin;
use_ok( 'C4::Barcodes', qw( value initial max db_max next_value next previous serial autoBarcode is_max ) ); use_ok('C4::Barcodes');
} }
my $builder = t::lib::TestBuilder->new; my $builder = t::lib::TestBuilder->new;

View File

@ -17,15 +17,12 @@
use Modern::Perl; use Modern::Perl;
use Test::NoWarnings; use Test::NoWarnings;
use Test::More tests => 10; use Test::More tests => 9;
use Test::MockModule; use Test::MockModule;
use t::lib::TestBuilder; use t::lib::TestBuilder;
use Koha::Database; use Koha::Database;
use C4::Barcodes::ValueBuilder;
BEGIN {
use_ok( 'C4::Barcodes::ValueBuilder', qw( get_barcode ) );
}
my $schema = Koha::Database->new->schema; my $schema = Koha::Database->new->schema;
$schema->storage->txn_begin; $schema->storage->txn_begin;

View File

@ -24,7 +24,7 @@ use Test::Warn;
use List::MoreUtils qw( uniq ); use List::MoreUtils qw( uniq );
use MARC::Record; use MARC::Record;
use t::lib::Mocks qw( mock_preference ); use t::lib::Mocks;
use t::lib::TestBuilder; use t::lib::TestBuilder;
use Koha::ActionLogs; use Koha::ActionLogs;

View File

@ -21,7 +21,7 @@ use Test::NoWarnings;
use Test::More tests => 4; use Test::More tests => 4;
use Test::MockModule; use Test::MockModule;
use MARC::Record; use MARC::Record;
use t::lib::Mocks qw( mock_preference ); use t::lib::Mocks;
use Koha::Database; use Koha::Database;

View File

@ -28,7 +28,7 @@ use Test::NoWarnings;
use Test::More tests => 6; use Test::More tests => 6;
use Test::Warn; use Test::Warn;
use t::lib::Mocks qw( mock_preference ); use t::lib::Mocks;
use t::lib::TestBuilder; use t::lib::TestBuilder;
use C4::Context; use C4::Context;

View File

@ -26,7 +26,7 @@ use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Database; use Koha::Database;
use t::lib::TestBuilder; use t::lib::TestBuilder;
use t::lib::Mocks qw( mock_preference ); use t::lib::Mocks;
my $schema = Koha::Database->new->schema; my $schema = Koha::Database->new->schema;
$schema->storage->txn_begin; $schema->storage->txn_begin;

View File

@ -32,7 +32,7 @@ use utf8;
use C4::AuthoritiesMarc qw/ AddAuthority /; use C4::AuthoritiesMarc qw/ AddAuthority /;
BEGIN { BEGIN {
use_ok( 'C4::Heading', qw( field valid_heading_subfield ) ); use_ok('C4::Heading');
} }
subtest "MARC21 tests" => sub { subtest "MARC21 tests" => sub {

View File

@ -11,7 +11,7 @@ use Test::More tests => 11;
use C4::Context; use C4::Context;
BEGIN { BEGIN {
use_ok( 'C4::Heading', qw( field new_from_field display_form search_form ) ); use_ok( 'C4::Heading', qw( new_from_field ) );
} }
SKIP: { SKIP: {

View File

@ -24,14 +24,13 @@ use Koha::Biblios;
use Koha::CirculationRules; use Koha::CirculationRules;
use Koha::Database; use Koha::Database;
use Koha::DateUtils qw( dt_from_string output_pref ); use Koha::DateUtils qw( dt_from_string output_pref );
use Koha::Holds qw( search ); use Koha::Holds;
use Koha::Checkout; use Koha::Checkout;
use Koha::Item::Transfer::Limits; use Koha::Item::Transfer::Limits;
use Koha::Items; use Koha::Items;
use Koha::Libraries; use Koha::Libraries;
use Koha::Library::Groups; use Koha::Library::Groups;
use Koha::Patrons; use Koha::Patrons;
use Koha::Hold qw( get_items_that_can_fill );
use Koha::Item::Transfers; use Koha::Item::Transfers;
BEGIN { BEGIN {

View File

@ -31,10 +31,7 @@ use Koha::DateUtils qw( dt_from_string );
BEGIN { BEGIN {
use_ok('Koha::Calendar'); use_ok('Koha::Calendar');
use_ok( use_ok('C4::Calendar');
'C4::Calendar',
qw( insert_exception_holiday insert_week_day_holiday insert_day_month_holiday insert_single_holiday copy_to_branch get_exception_holidays isHoliday )
);
} }
my $schema = Koha::Database->new->schema; my $schema = Koha::Database->new->schema;

View File

@ -37,10 +37,7 @@ use Koha::DateUtils qw( dt_from_string );
use Koha::MarcSubfieldStructures; use Koha::MarcSubfieldStructures;
BEGIN { BEGIN {
use_ok( use_ok('C4::ILSDI::Services');
'C4::ILSDI::Services',
qw( AuthenticatePatron GetPatronInfo LookupPatron HoldTitle HoldItem GetRecords RenewLoan GetAvailability )
);
} }
my $schema = Koha::Database->schema; my $schema = Koha::Database->schema;

View File

@ -23,7 +23,7 @@ use Test::Warn;
use File::Basename; use File::Basename;
use Koha::Account qw( add_credit ); use Koha::Account;
use t::lib::Mocks; use t::lib::Mocks;
use t::lib::TestBuilder; use t::lib::TestBuilder;

View File

@ -10,7 +10,7 @@ use Test::More tests => 4;
use t::lib::Mocks; use t::lib::Mocks;
BEGIN { BEGIN {
use_ok( 'Koha::Template::Plugin::JSConsents', "Can use Koha::Template::Plugin::JSConsents" ); use_ok('Koha::Template::Plugin::JSConsents');
} }
ok( my $consents = Koha::Template::Plugin::JSConsents->new(), 'Able to instantiate template plugin' ); ok( my $consents = Koha::Template::Plugin::JSConsents->new(), 'Able to instantiate template plugin' );

View File

@ -48,7 +48,7 @@ $mock_plugin->mock(
} }
); );
use_ok( 'Koha::Template::Plugin::KohaPlugins', 'Can use Koha::Template::Plugin::KohaPlugins' ); use_ok('Koha::Template::Plugin::KohaPlugins');
ok( my $plugin = Koha::Template::Plugin::KohaPlugins->new(), 'Able to instantiate template plugin' ); ok( my $plugin = Koha::Template::Plugin::KohaPlugins->new(), 'Able to instantiate template plugin' );

View File

@ -7,10 +7,13 @@ use C4::Context;
use Test::MockModule; use Test::MockModule;
use Test::NoWarnings; use Test::NoWarnings;
use Test::More tests => 4; use Test::More tests => 4;
use t::lib::Mocks; use t::lib::Mocks;
use Koha::Template::Plugin::TablesSettings;
BEGIN { BEGIN {
use_ok( 'Koha::Template::Plugin::TablesSettings', "Can use Koha::Template::Plugin::TablesSettings" ); use_ok('Koha::Template::Plugin::TablesSettings');
} }
ok( my $settings = Koha::Template::Plugin::TablesSettings->new(), 'Able to instantiate template plugin' ); ok( my $settings = Koha::Template::Plugin::TablesSettings->new(), 'Able to instantiate template plugin' );

View File

@ -6,7 +6,7 @@ use utf8;
use Test::NoWarnings; use Test::NoWarnings;
use Test::More tests => 4; use Test::More tests => 4;
use Test::WWW::Mechanize; use Test::WWW::Mechanize;
use t::lib::Mocks qw(mock_preference); use t::lib::Mocks;
use File::Basename; use File::Basename;
use File::Copy; use File::Copy;

View File

@ -5,7 +5,7 @@ use Modern::Perl;
use Test::NoWarnings; use Test::NoWarnings;
use Test::More tests => 4; use Test::More tests => 4;
use Test::MockObject; use Test::MockObject;
use t::lib::Mocks qw(mock_preference); use t::lib::Mocks;
use ZOOM; use ZOOM;

View File

@ -21,7 +21,7 @@
use Modern::Perl; use Modern::Perl;
use Test::NoWarnings; use Test::NoWarnings;
use Test::More tests => 26; use Test::More tests => 25;
use MARC::Record; use MARC::Record;
use MARC::Field; use MARC::Field;
@ -30,13 +30,10 @@ use t::lib::TestBuilder;
use C4::Context; use C4::Context;
use C4::Items qw( AddItemBatchFromMarc ); use C4::Items qw( AddItemBatchFromMarc );
use C4::Biblio qw( GetMarcFromKohaField AddBiblio ); use C4::Biblio qw( GetMarcFromKohaField AddBiblio );
use C4::Labels::Batch;
use Koha::Database; use Koha::Database;
use Koha::Libraries; use Koha::Libraries;
BEGIN {
use_ok( 'C4::Labels::Batch', qw( save retrieve delete ) );
}
my $schema = Koha::Database->new->schema; my $schema = Koha::Database->new->schema;
$schema->storage->txn_begin; $schema->storage->txn_begin;
my $dbh = C4::Context->dbh; my $dbh = C4::Context->dbh;

View File

@ -22,10 +22,10 @@ use Test::More tests => 3;
use MARC::Record; use MARC::Record;
use MARC::Field; use MARC::Field;
use MARC::File::XML; use MARC::File::XML;
use C4::Heading qw( authorities field new_from_field auth_type search_form ); use C4::Heading;
use C4::Linker::Default; use C4::Linker::Default;
use Test::MockModule; use Test::MockModule;
use t::lib::Mocks qw( mock_preference ); use t::lib::Mocks;
use t::lib::TestBuilder; use t::lib::TestBuilder;
BEGIN { BEGIN {

View File

@ -25,10 +25,10 @@ use Test::More tests => 4;
use MARC::Record; use MARC::Record;
use MARC::Field; use MARC::Field;
use MARC::File::XML; use MARC::File::XML;
use C4::Heading qw( authorities field new_from_field ); use C4::Heading;
use C4::Linker::FirstMatch; use C4::Linker::FirstMatch;
use Test::MockModule; use Test::MockModule;
use t::lib::Mocks qw( mock_preference ); use t::lib::Mocks;
use t::lib::TestBuilder; use t::lib::TestBuilder;
BEGIN { BEGIN {

View File

@ -25,7 +25,7 @@ use C4::Auth qw( checkpw );
use Koha::Database; use Koha::Database;
use Koha::ActionLogs; use Koha::ActionLogs;
use t::lib::Mocks qw/mock_preference/; # to mock CronjobLog use t::lib::Mocks;
use t::lib::TestBuilder; use t::lib::TestBuilder;
use JSON qw( decode_json ); use JSON qw( decode_json );

View File

@ -25,7 +25,7 @@ use t::lib::TestBuilder;
use t::lib::Mocks; use t::lib::Mocks;
use Koha::Database; use Koha::Database;
use C4::Matcher qw( GetMatcherList GetMatcherId ); use C4::Matcher;
my $schema = Koha::Database->new->schema; my $schema = Koha::Database->new->schema;
my $builder = t::lib::TestBuilder->new; my $builder = t::lib::TestBuilder->new;

View File

@ -23,7 +23,7 @@ use Test::MockModule;
use C4::Circulation qw( AddIssue AddReturn transferbook ); use C4::Circulation qw( AddIssue AddReturn transferbook );
use C4::SIP::ILS; use C4::SIP::ILS;
use C4::SIP::ILS::Transaction::Checkin qw( do_checkin ); use C4::SIP::ILS::Transaction::Checkin;
use Koha::Checkouts; use Koha::Checkouts;
use Koha::Database; use Koha::Database;

View File

@ -38,7 +38,7 @@ BEGIN {
$mockPrefork->mock( 'run', sub { } ); $mockPrefork->mock( 'run', sub { } );
} }
use C4::SIP::SIPServer qw( get_timeout ); use C4::SIP::SIPServer;
# Start testing ! # Start testing !
# TODO We should include more tests here. # TODO We should include more tests here.

View File

@ -18,6 +18,7 @@ use URI::Escape;
use List::Util qw( shuffle ); use List::Util qw( shuffle );
use C4::Context; use C4::Context;
use C4::Search::History;
use Koha::DateUtils qw( dt_from_string output_pref ); use Koha::DateUtils qw( dt_from_string output_pref );
my $schema = Koha::Database->new->schema; my $schema = Koha::Database->new->schema;
@ -29,7 +30,7 @@ my $dbh = C4::Context->dbh;
t::lib::Mocks::mock_preference( 'SessionStorage', 'tmp' ); t::lib::Mocks::mock_preference( 'SessionStorage', 'tmp' );
use_ok('Koha::DateUtils'); use_ok('Koha::DateUtils');
use_ok( 'C4::Search::History', qw( add get delete get_from_session ) ); use_ok('C4::Search::History');
my $userid = 123; my $userid = 123;
my $previous_sessionid = "PREVIOUS_SESSIONID"; my $previous_sessionid = "PREVIOUS_SESSIONID";

View File

@ -24,7 +24,7 @@ use Test::More tests => 3;
use t::lib::TestBuilder; use t::lib::TestBuilder;
use Koha::Database; use Koha::Database;
use C4::SocialData qw( get_data get_report ); use C4::SocialData;
my $schema = Koha::Database->new->schema; my $schema = Koha::Database->new->schema;
my $builder = t::lib::TestBuilder->new; my $builder = t::lib::TestBuilder->new;

View File

@ -19,7 +19,7 @@ use Modern::Perl;
use Test::NoWarnings; use Test::NoWarnings;
use Test::More tests => 4; use Test::More tests => 4;
use t::lib::Mocks qw(mock_preference); use t::lib::Mocks;
use t::lib::TestBuilder; use t::lib::TestBuilder;
use POSIX qw(strftime); use POSIX qw(strftime);
@ -34,7 +34,7 @@ use Koha::Old::Holds;
use Koha::Patrons; use Koha::Patrons;
BEGIN { BEGIN {
use_ok( 'C4::UsageStats', qw( BuildReport ReportToCommunity _count ) ); use_ok('C4::UsageStats');
} }
can_ok( can_ok(

View File

@ -9,7 +9,7 @@ use Koha::DateUtils qw( dt_from_string );
use Koha::Libraries; use Koha::Libraries;
use Koha::Patrons; use Koha::Patrons;
use t::lib::TestBuilder; use t::lib::TestBuilder;
use t::lib::Mocks qw(mock_preference); use t::lib::Mocks;
use Test::NoWarnings; use Test::NoWarnings;
use Test::More tests => 9; use Test::More tests => 9;