From 41872c9a70cb6f1163598155f029716aae3199fd 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 Signed-off-by: David Nind Signed-off-by: Nick Clemens --- t/00-check-atomic-updates.t | 12 +++++------- t/00-load.t | 4 ++-- t/00-testcritic.t | 4 +++- t/00-valid-xml.t | 8 +++++--- 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, 51 insertions(+), 75 deletions(-) diff --git a/t/00-check-atomic-updates.t b/t/00-check-atomic-updates.t index 52c221eeb79..8237812fb65 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 438c596ae54..f0098485669 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; @@ -101,5 +101,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 fdf7df267c9..635d4d06ec2 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 a4c79df1b3c..baa36291d46 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; @@ -44,6 +43,9 @@ find( } }, }, + , File::Spec->curdir() ); + +had_no_warnings; done_testing(); diff --git a/t/Biblio.t b/t/Biblio.t index 0902fa6dde2..c484e35d154 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 2f87ab6e502..f5e72214f9e 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; @@ -58,5 +58,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 299cd8b341a..044c6626e96 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'); @@ -77,5 +77,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 670340bd521..0401b3e18bf 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; @@ -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::Labels::Label'); use vars qw($ccns); } diff --git a/t/Labels_split_ddcn.t b/t/Labels_split_ddcn.t index e3ef5e9e9a1..77d09c59acf 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; @@ -41,7 +40,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 6d112e5c5f1..cfb3ff2e3b8 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; @@ -44,7 +43,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 32e8512b820..c5a967788e5 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'); @@ -236,5 +236,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 ac28ee5a5dd..832f9b5134e 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 { @@ -53,4 +52,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 3899af48f72..5a1e47100fc 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 510291300b7..4516602f933 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 ); @@ -89,5 +89,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 6dcd1c00d22..00083fcc426 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 259ac5581ac..5a91fd7952f 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 bf527690cf4..18f0304cf5a 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 7eaed22b73a..b476f41c613 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 a9bdcdab1d0..1f322ebf0d8 100755 --- a/t/db_dependent/MungeMarcPrice.t +++ b/t/db_dependent/MungeMarcPrice.t @@ -30,7 +30,7 @@ my @prices2test = ( { 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 4797b46c6ac..c10a46e2d4d 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; @@ -113,5 +112,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 ceb5f49cc25..ddb476236ab 100755 --- a/t/db_dependent/Search/History.t +++ b/t/db_dependent/Search/History.t @@ -521,5 +521,3 @@ subtest 'LoadSearchHistoryToTheFirstLoggedUser working' => sub { $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 22fa3752a6e..185f4b40ff4 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 7d05083f409..baebf707a7a 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; @@ -62,6 +62,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 7b127ca2721..2fd91cd182d 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 bf513c09f71..68fa2dd1e83 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 75f3b69ec0a..c8383e294bb 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 3f472560ef1..82d121d02d3 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 56d336e977d..8e56ecf8b3c 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 43f2a28d6b9..0da3344efff 100755 --- a/t/db_dependent/www/rest_api.t +++ b/t/db_dependent/www/rest_api.t @@ -29,7 +29,7 @@ if ($@) { } 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 82743a54ff8..1553d43bdf2 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.39.5