From d543ebe51f6a0e3b6d8244e7a501cfd307c52eff Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 22 Jan 2025 14:43:15 +0100 Subject: [PATCH] Bug 38944: Manual changes Not caught by the script --- t/00-check-atomic-updates.t | 12 +++++------- t/00-load.t | 4 ++-- t/00-testcritic.t | 4 +++- t/00-valid-xml.t | 7 ++++--- t/Biblio.t | 4 +--- t/Biblio2.t | 4 +--- t/Koha/DateTime/Format/RFC3339.t | 4 +--- t/Koha/DateTime/Format/SQL.t | 4 +--- t/Koha_SearchEngine_Elasticsearch_Browse.t | 4 +--- t/Labels_split_ccn.t | 5 ++--- t/Labels_split_ddcn.t | 5 ++--- t/Labels_split_lccn.t | 5 ++--- t/RecordProcessor.t | 4 +--- t/SuggestionEngine.t | 6 +++--- t/db_dependent/00-strict.t | 6 +++--- t/db_dependent/Acquisition/GetOrdersByBiblionumber.t | 4 +--- t/db_dependent/Budgets/CloneBudgetHierarchy.t | 4 +--- t/db_dependent/Koha/Item/Attributes.t | 2 +- t/db_dependent/Koha/Items/BatchUpdate.t | 2 +- t/db_dependent/Koha_ExternalContent_OverDrive.t | 2 +- t/db_dependent/MungeMarcPrice.t | 2 +- .../RecordProcessor_EmbedSeeFromHeadings.t | 7 ++----- t/db_dependent/Search/History.t | 2 -- t/db_dependent/api/v1/oauth.t | 2 +- t/db_dependent/db_structure.t | 5 ++--- t/db_dependent/selenium/patrons_search.t | 2 +- t/db_dependent/selenium/remove_from_cart.t | 2 +- t/db_dependent/selenium/self_registration.t | 2 +- t/db_dependent/selenium/system_preferences_search.t | 2 +- t/db_dependent/selenium/update_child_to_adult.t | 2 +- t/db_dependent/www/rest_api.t | 2 +- t/db_dependent/yaml.t | 3 +-- 32 files changed, 50 insertions(+), 75 deletions(-) diff --git a/t/00-check-atomic-updates.t b/t/00-check-atomic-updates.t index 8ac7818ccf0..49cca9a35fa 100755 --- a/t/00-check-atomic-updates.t +++ b/t/00-check-atomic-updates.t @@ -17,7 +17,7 @@ use Modern::Perl; use Test::NoWarnings; -use Test::More; +use Test::More tests => 2; use File::Find; SKIP: { @@ -29,14 +29,12 @@ SKIP: { find( \&wanted, $dir ); sub wanted { + return if $_ eq 'skeleton.pl'; + return if $_ eq 'README'; + return if $_ eq '.'; push @files, $_; return; } - foreach my $f (@files) { - next if $f eq 'skeleton.pl'; - unlike( $f, qr/.*pl$/, "check for unhandled atomic updates: $f" ); - } + is(scalar(@files), 0, "No atomic updates") or diag join "\n", @files; }; - -done_testing(); diff --git a/t/00-load.t b/t/00-load.t index 34c36800170..f22a875b0e9 100755 --- a/t/00-load.t +++ b/t/00-load.t @@ -19,7 +19,7 @@ use Modern::Perl; -use Test::NoWarnings; +use Test::NoWarnings qw( had_no_warnings ); use Test::More; use File::Spec; use File::Find; @@ -103,5 +103,5 @@ sub is_testable { return $return_value; } +had_no_warnings; done_testing(); - diff --git a/t/00-testcritic.t b/t/00-testcritic.t index 43192e3b2e3..d975e2c1d3e 100755 --- a/t/00-testcritic.t +++ b/t/00-testcritic.t @@ -3,7 +3,7 @@ # This script can be used to run perlcritic on perl files in koha use Modern::Perl; -use Test::NoWarnings; +use Test::NoWarnings qw( had_no_warnings ); use Test::More; use English qw(-no_match_vars); @@ -17,3 +17,5 @@ if ( $EVAL_ERROR ) { Test::Perl::Critic->import( -profile => '.perlcriticrc' ); my @files = map { chomp; $_ } `git ls-tree -r HEAD --name-only`; # only files part of git all_critic_ok(@files); + +had_no_warnings; diff --git a/t/00-valid-xml.t b/t/00-valid-xml.t index f66fe4ba7ee..47ae5af30fe 100755 --- a/t/00-valid-xml.t +++ b/t/00-valid-xml.t @@ -15,10 +15,9 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -use warnings; +use Modern::Perl; -use Test::NoWarnings; +use Test::NoWarnings qw( had_no_warnings ); use Test::More; use File::Spec; use File::Find; @@ -43,4 +42,6 @@ find({ } }, }, File::Spec->curdir()); + +had_no_warnings; done_testing(); diff --git a/t/Biblio.t b/t/Biblio.t index bcc86c4cb31..73ee3b13d5e 100755 --- a/t/Biblio.t +++ b/t/Biblio.t @@ -18,12 +18,10 @@ use Modern::Perl; use Test::NoWarnings; -use Test::More; +use Test::More tests => 33; use Test::MockModule; use Test::Warn; -plan tests => 32; - use_ok('C4::Biblio', qw( AddBiblio ModBiblio BiblioAutoLink LinkBibHeadingsToAuthorities GetMarcPrice GetMarcQuantity GetMarcISBN GetMarcISSN GetMarcSubjects GetMarcUrls GetMarcSeries TransformMarcToKoha ModBiblioMarc RemoveAllNsb UpdateTotalIssues )); diff --git a/t/Biblio2.t b/t/Biblio2.t index 107170dc8ef..02b21ae52b4 100755 --- a/t/Biblio2.t +++ b/t/Biblio2.t @@ -2,7 +2,7 @@ use Modern::Perl; use Test::NoWarnings; -use Test::More; +use Test::More tests => 3; use Test::MockModule; use MARC::Record; @@ -52,5 +52,3 @@ sub _koha_marc_update_bib_ids_control { is($r->field('001')->data(), 10, 'Biblionumber to control field'); is($r->field('004')->data(), 20, 'Biblioitemnumber to control field'); } - -done_testing(); diff --git a/t/Koha/DateTime/Format/RFC3339.t b/t/Koha/DateTime/Format/RFC3339.t index e3df3a569e0..eb0b6ea4e26 100755 --- a/t/Koha/DateTime/Format/RFC3339.t +++ b/t/Koha/DateTime/Format/RFC3339.t @@ -2,7 +2,7 @@ use Modern::Perl; use Test::NoWarnings; -use Test::More; +use Test::More tests => 6; use Test::Exception; BEGIN { use_ok('Koha::DateTime::Format::RFC3339'); } @@ -58,5 +58,3 @@ subtest 'invalid date throws an exception' => sub { } qr/Invalid date format/; }; - -done_testing; diff --git a/t/Koha/DateTime/Format/SQL.t b/t/Koha/DateTime/Format/SQL.t index 1668aef6206..56cb4fde679 100755 --- a/t/Koha/DateTime/Format/SQL.t +++ b/t/Koha/DateTime/Format/SQL.t @@ -5,7 +5,7 @@ use DateTime::TimeZone; use Test::Exception; use Test::MockModule; use Test::NoWarnings; -use Test::More; +use Test::More tests => 6; BEGIN { use_ok('Koha::DateTime::Format::SQL'); } @@ -81,5 +81,3 @@ subtest 'normal datetime, with timezone configured' => sub { is( $dt->second, 12 ); is( $dt->time_zone->name, 'floating' ); }; - -done_testing; diff --git a/t/Koha_SearchEngine_Elasticsearch_Browse.t b/t/Koha_SearchEngine_Elasticsearch_Browse.t index 964ace8c506..359b7c36eae 100755 --- a/t/Koha_SearchEngine_Elasticsearch_Browse.t +++ b/t/Koha_SearchEngine_Elasticsearch_Browse.t @@ -20,7 +20,7 @@ use Modern::Perl; use Test::NoWarnings; -use Test::More; +use Test::More tests => 4; use_ok('Koha::SearchEngine::Elasticsearch::Browse'); @@ -65,5 +65,3 @@ subtest "_build_query tests" => sub { } }, 'Fuzziness and size specified'); }; - -done_testing(); diff --git a/t/Labels_split_ccn.t b/t/Labels_split_ccn.t index 5476d896b83..507f86e18cb 100755 --- a/t/Labels_split_ccn.t +++ b/t/Labels_split_ccn.t @@ -17,8 +17,7 @@ # # for context, see http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=2691 -use strict; -use warnings; +use Modern::Perl; use Test::NoWarnings; use Test::More; @@ -43,7 +42,7 @@ BEGIN { $test_num += 2 * $split_num; $test_num += 4; } - plan tests => $test_num; + plan tests => $test_num + 1; use_ok('C4::Labels::Label'); use vars qw($ccns); } diff --git a/t/Labels_split_ddcn.t b/t/Labels_split_ddcn.t index 62c335e5409..179889db09a 100755 --- a/t/Labels_split_ddcn.t +++ b/t/Labels_split_ddcn.t @@ -17,8 +17,7 @@ # # for context, see http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=2691 -use strict; -use warnings; +use Modern::Perl; use Test::NoWarnings; use Test::More; @@ -42,7 +41,7 @@ BEGIN { $test_num += 2 * $split_num; $test_num += 4; } - plan tests => $test_num; + plan tests => $test_num + 1; use_ok('C4::ClassSplitRoutine::Dewey', qw( split_callnumber )); use vars qw($ddcns); } diff --git a/t/Labels_split_lccn.t b/t/Labels_split_lccn.t index 6b72c0849a7..7dc110dd9d6 100755 --- a/t/Labels_split_lccn.t +++ b/t/Labels_split_lccn.t @@ -17,8 +17,7 @@ # # for context, see http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=2691 -use strict; -use warnings; +use Modern::Perl; use C4::ClassSplitRoutine::LCC qw( split_callnumber ); use Test::NoWarnings; @@ -45,7 +44,7 @@ BEGIN { $test_num += 2 * $split_num; $test_num += 4; } - plan tests => $test_num; + plan tests => $test_num + 1; use_ok('C4::Labels::Label'); use vars qw($lccns); } diff --git a/t/RecordProcessor.t b/t/RecordProcessor.t index 2403e26a212..95c29d682e5 100755 --- a/t/RecordProcessor.t +++ b/t/RecordProcessor.t @@ -23,7 +23,7 @@ use File::Spec; use MARC::Record; use English qw( -no_match_vars ); use Test::NoWarnings; -use Test::More; +use Test::More tests => 21; BEGIN { use_ok('Koha::RecordProcessor'); @@ -227,5 +227,3 @@ subtest "'TrimFields' filter tests" => sub { my $get521a = $record->subfield( '521', 'a' ); is( $get521a, "This is a\t test!", "Trailing tabs are stripped while inner tabs are kept" ); }; - -done_testing(); diff --git a/t/SuggestionEngine.t b/t/SuggestionEngine.t index 511f9df36f4..8abdb60ff8f 100755 --- a/t/SuggestionEngine.t +++ b/t/SuggestionEngine.t @@ -1,10 +1,9 @@ #!/usr/bin/perl -use strict; -use warnings; +use Modern::Perl; use File::Spec; -use Test::NoWarnings; +use Test::NoWarnings qw( had_no_warnings ); use Test::More; BEGIN { @@ -44,4 +43,5 @@ eval { }; ok(!$@, 'Destroyed suggestor successfully'); +had_no_warnings; done_testing(); diff --git a/t/db_dependent/00-strict.t b/t/db_dependent/00-strict.t index 34aa248e65e..f00f09e39ce 100755 --- a/t/db_dependent/00-strict.t +++ b/t/db_dependent/00-strict.t @@ -1,11 +1,10 @@ #!/usr/bin/perl # This script is called by the pre-commit git hook to test modules compile -use strict; -use warnings; +use Modern::Perl; use threads; # used for parallel -use Test::NoWarnings; +use Test::NoWarnings qw( had_no_warnings ); use Test::More; use Test::Strict; use Parallel::ForkManager; @@ -55,4 +54,5 @@ foreach my $d (@dirs) { $pm->wait_all_children; +had_no_warnings; done_testing(); diff --git a/t/db_dependent/Acquisition/GetOrdersByBiblionumber.t b/t/db_dependent/Acquisition/GetOrdersByBiblionumber.t index c81660d3375..846035577de 100755 --- a/t/db_dependent/Acquisition/GetOrdersByBiblionumber.t +++ b/t/db_dependent/Acquisition/GetOrdersByBiblionumber.t @@ -3,7 +3,7 @@ use Modern::Perl; use Test::NoWarnings; -use Test::More; +use Test::More tests => 4; use C4::Acquisition qw( NewBasket GetOrders GetOrdersByBiblionumber GetOrder ); use C4::Biblio qw( AddBiblio ); use C4::Budgets qw( AddBudget GetBudget ); @@ -91,5 +91,3 @@ is(scalar(@orders), 2, '2 orders on biblionumber 2'); #End transaction $schema->storage->txn_rollback(); - -done_testing; diff --git a/t/db_dependent/Budgets/CloneBudgetHierarchy.t b/t/db_dependent/Budgets/CloneBudgetHierarchy.t index f50b7215012..a9774cd9497 100755 --- a/t/db_dependent/Budgets/CloneBudgetHierarchy.t +++ b/t/db_dependent/Budgets/CloneBudgetHierarchy.t @@ -3,7 +3,7 @@ use Modern::Perl; use Test::NoWarnings; -use Test::More; +use Test::More tests => 2; use Koha::Database; use Koha::Acquisition::Budget; @@ -13,8 +13,6 @@ use C4::Budgets qw(AddBudget CloneBudgetHierarchy GetBudgetHierarchy); use t::lib::TestBuilder; -plan tests => 1; - my $schema = Koha::Database->schema; my $builder = t::lib::TestBuilder->new; diff --git a/t/db_dependent/Koha/Item/Attributes.t b/t/db_dependent/Koha/Item/Attributes.t index 5b10f05f198..19234781582 100755 --- a/t/db_dependent/Koha/Item/Attributes.t +++ b/t/db_dependent/Koha/Item/Attributes.t @@ -17,7 +17,7 @@ use Modern::Perl; use Test::NoWarnings; -use Test::More tests=> 10; +use Test::More tests => 11; use utf8; use Koha::Database; diff --git a/t/db_dependent/Koha/Items/BatchUpdate.t b/t/db_dependent/Koha/Items/BatchUpdate.t index 79cd3d32c44..98db61898b6 100755 --- a/t/db_dependent/Koha/Items/BatchUpdate.t +++ b/t/db_dependent/Koha/Items/BatchUpdate.t @@ -17,7 +17,7 @@ use Modern::Perl; use Test::NoWarnings; -use Test::More tests=> 8; +use Test::More tests => 9; use Test::Warn; use utf8; diff --git a/t/db_dependent/Koha_ExternalContent_OverDrive.t b/t/db_dependent/Koha_ExternalContent_OverDrive.t index c34eb99f7c1..051ad2cf6b9 100755 --- a/t/db_dependent/Koha_ExternalContent_OverDrive.t +++ b/t/db_dependent/Koha_ExternalContent_OverDrive.t @@ -11,7 +11,7 @@ use Module::Load::Conditional qw( can_load check_install ); BEGIN { if ( check_install( module => 'WebService::ILS::OverDrive::Patron' ) ) { - plan tests => 6; + plan tests => 7; } else { plan skip_all => "Need WebService::ILS::OverDrive::Patron" } diff --git a/t/db_dependent/MungeMarcPrice.t b/t/db_dependent/MungeMarcPrice.t index c85c5a4a4e1..849f9bba6e1 100755 --- a/t/db_dependent/MungeMarcPrice.t +++ b/t/db_dependent/MungeMarcPrice.t @@ -29,7 +29,7 @@ my @prices2test=( { string => '25,5 £, $34,55, $LD35', expected => '34.55 { string => '5.99 (7.75 CAN)', expected => '5.99' }, ); -plan tests => 2 * scalar @prices2test; +plan tests => 1 + 2 * scalar @prices2test; # set active currency test data my $CURRENCY = 'TEST'; diff --git a/t/db_dependent/RecordProcessor_EmbedSeeFromHeadings.t b/t/db_dependent/RecordProcessor_EmbedSeeFromHeadings.t index 48ba21cf603..3ac4863987e 100755 --- a/t/db_dependent/RecordProcessor_EmbedSeeFromHeadings.t +++ b/t/db_dependent/RecordProcessor_EmbedSeeFromHeadings.t @@ -17,14 +17,13 @@ # You should have received a copy of the GNU General Public License # along with Koha; if not, see . -use strict; -use warnings; +use Modern::Perl; use File::Spec; use MARC::Record; use Koha::MetadataRecord::Authority; use Test::NoWarnings; -use Test::More; +use Test::More tests => 5; use Test::MockModule; use Test::MockObject; @@ -111,5 +110,3 @@ subtest "EmbedSeeFromHeadings should skip holdings fields" => sub { is_deeply($result, $record_copy, 'Holdings fields not processed to introduce See-from heading'); }; - -done_testing(); diff --git a/t/db_dependent/Search/History.t b/t/db_dependent/Search/History.t index 0bd7b16356b..a32e14496f6 100755 --- a/t/db_dependent/Search/History.t +++ b/t/db_dependent/Search/History.t @@ -474,5 +474,3 @@ $result = $schema->resultset('SearchHistory')->search()->count; $result2 = $schema->resultset('SearchHistory')->search()->count; is($result2, $result+1, 'new search added to borrower'); }; - -done_testing; diff --git a/t/db_dependent/api/v1/oauth.t b/t/db_dependent/api/v1/oauth.t index 78eb9a21b3a..cbf3d09775f 100755 --- a/t/db_dependent/api/v1/oauth.t +++ b/t/db_dependent/api/v1/oauth.t @@ -37,7 +37,7 @@ my $schema = Koha::Database->new->schema; my $builder = t::lib::TestBuilder->new(); if ( can_load( modules => { 'Net::OAuth2::AuthorizationServer' => undef } ) ) { - plan tests => 2; + plan tests => 3; } else { plan skip_all => 'Net::OAuth2::AuthorizationServer not available'; diff --git a/t/db_dependent/db_structure.t b/t/db_dependent/db_structure.t index 906e121afd2..303b417035e 100755 --- a/t/db_dependent/db_structure.t +++ b/t/db_dependent/db_structure.t @@ -17,7 +17,7 @@ use Modern::Perl; -use Test::NoWarnings; +use Test::NoWarnings qw( had_no_warnings ); use Test::More; use Koha::Database; @@ -59,6 +59,5 @@ for my $modules ( @modules ) { } } } - +had_no_warnings; done_testing(); - diff --git a/t/db_dependent/selenium/patrons_search.t b/t/db_dependent/selenium/patrons_search.t index b561225c489..af7bc73304a 100755 --- a/t/db_dependent/selenium/patrons_search.t +++ b/t/db_dependent/selenium/patrons_search.t @@ -42,7 +42,7 @@ eval { require Selenium::Remote::Driver; }; if ( $@ ) { plan skip_all => "Selenium::Remote::Driver is needed for selenium tests."; } else { - plan tests => 2; + plan tests => 3; } my $s = t::lib::Selenium->new; diff --git a/t/db_dependent/selenium/remove_from_cart.t b/t/db_dependent/selenium/remove_from_cart.t index c7ceec50020..3dedc7079f9 100755 --- a/t/db_dependent/selenium/remove_from_cart.t +++ b/t/db_dependent/selenium/remove_from_cart.t @@ -34,7 +34,7 @@ eval { require Selenium::Remote::Driver; }; if ( $@ ) { plan skip_all => "Selenium::Remote::Driver is needed for selenium tests."; } else { - plan tests => 1; + plan tests => 2; } my $s = t::lib::Selenium->new; diff --git a/t/db_dependent/selenium/self_registration.t b/t/db_dependent/selenium/self_registration.t index 0f98723b019..7ce493aa995 100755 --- a/t/db_dependent/selenium/self_registration.t +++ b/t/db_dependent/selenium/self_registration.t @@ -34,7 +34,7 @@ eval { require Selenium::Remote::Driver; }; if ( $@ ) { plan skip_all => "Selenium::Remote::Driver is needed for selenium tests."; } else { - plan tests => 2; + plan tests => 3; } my $s = t::lib::Selenium->new; diff --git a/t/db_dependent/selenium/system_preferences_search.t b/t/db_dependent/selenium/system_preferences_search.t index 0df3908051d..7707731d63a 100755 --- a/t/db_dependent/selenium/system_preferences_search.t +++ b/t/db_dependent/selenium/system_preferences_search.t @@ -27,7 +27,7 @@ eval { require Selenium::Remote::Driver; }; if ( $@ ) { plan skip_all => "Selenium::Remote::Driver is needed for Selenium tests."; } else { - plan tests => 1; + plan tests => 2; } my @cleanup; diff --git a/t/db_dependent/selenium/update_child_to_adult.t b/t/db_dependent/selenium/update_child_to_adult.t index 57b64d4aa8b..d6595535855 100755 --- a/t/db_dependent/selenium/update_child_to_adult.t +++ b/t/db_dependent/selenium/update_child_to_adult.t @@ -33,7 +33,7 @@ eval { require Selenium::Remote::Driver; }; if ( $@ ) { plan skip_all => "Selenium::Remote::Driver is needed for selenium tests."; } else { - plan tests => 1; + plan tests => 2; } my $s = t::lib::Selenium->new; diff --git a/t/db_dependent/www/rest_api.t b/t/db_dependent/www/rest_api.t index d25d2b731a0..efae9dc04dd 100755 --- a/t/db_dependent/www/rest_api.t +++ b/t/db_dependent/www/rest_api.t @@ -33,7 +33,7 @@ elsif (not defined $intranet) { plan skip_all => "Tests skip. You must set env. variable KOHA_INTRANET_URL to do tests\n"; } else { - plan tests => 1; + plan tests => 2; } $intranet =~ s#/$##; diff --git a/t/db_dependent/yaml.t b/t/db_dependent/yaml.t index 3d442bd189a..11ee088eaa9 100755 --- a/t/db_dependent/yaml.t +++ b/t/db_dependent/yaml.t @@ -1,6 +1,6 @@ use Modern::Perl; use Test::NoWarnings; -use Test::More; +use Test::More tests => 5; use YAML::XS; use Template; @@ -72,4 +72,3 @@ is_deeply( } ] ); -done_testing; -- 2.34.1