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 );
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();

View File

@ -10,7 +10,7 @@ use Test::NoWarnings;
use Test::More tests => 3;
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();

View File

@ -10,7 +10,7 @@ use Test::NoWarnings;
use Test::More tests => 11;
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 );

View File

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

View File

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

View File

@ -19,7 +19,7 @@ use Test::More tests => 42;
BEGIN {
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 );

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -30,7 +30,7 @@ $| = 1;
BEGIN {
use FindBin;
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;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -10,7 +10,7 @@ use Test::More tests => 4;
use t::lib::Mocks;
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' );

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' );

View File

@ -7,10 +7,13 @@ use C4::Context;
use Test::MockModule;
use Test::NoWarnings;
use Test::More tests => 4;
use t::lib::Mocks;
use Koha::Template::Plugin::TablesSettings;
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' );

View File

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

View File

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

View File

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

View File

@ -22,10 +22,10 @@ use Test::More tests => 3;
use MARC::Record;
use MARC::Field;
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 Test::MockModule;
use t::lib::Mocks qw( mock_preference );
use t::lib::Mocks;
use t::lib::TestBuilder;
BEGIN {

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -18,6 +18,7 @@ use URI::Escape;
use List::Util qw( shuffle );
use C4::Context;
use C4::Search::History;
use Koha::DateUtils qw( dt_from_string output_pref );
my $schema = Koha::Database->new->schema;
@ -29,7 +30,7 @@ my $dbh = C4::Context->dbh;
t::lib::Mocks::mock_preference( 'SessionStorage', 'tmp' );
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 $previous_sessionid = "PREVIOUS_SESSIONID";

View File

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

View File

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

View File

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