From f4664c8927f2b2f5bd5de34f0e464a1990303f37 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 15 Jul 2025 12:45:10 +0200 Subject: [PATCH] Bug 40379: Remove warnings from t/db_dependent/www XMLin complains because there are several nodes with the same name attribute. Not sure what is correct or not, but we actually cannot use the admin/DBMS user to login to the Koha interface. We use KOHA_USER env var or default to 'koha'. --- t/db_dependent/www/auth_values_input_www.t | 11 ++++------- t/db_dependent/www/batch.t | 11 ++++------- t/db_dependent/www/history.t | 11 ++++------- t/db_dependent/www/search_utf8.t | 8 ++++---- 4 files changed, 16 insertions(+), 25 deletions(-) diff --git a/t/db_dependent/www/auth_values_input_www.t b/t/db_dependent/www/auth_values_input_www.t index 2a93f7aff9d..f42c5f44f97 100755 --- a/t/db_dependent/www/auth_values_input_www.t +++ b/t/db_dependent/www/auth_values_input_www.t @@ -19,8 +19,8 @@ use Modern::Perl; use utf8; use Test::More; #See plan tests => \d+ below +use Test::NoWarnings; use Test::WWW::Mechanize; -use XML::Simple; use JSON; use File::Basename; use File::Spec; @@ -32,11 +32,8 @@ use Koha::AuthorisedValueCategories; my $testdir = File::Spec->rel2abs( dirname(__FILE__) ); -my $koha_conf = $ENV{KOHA_CONF}; -my $xml = XMLin($koha_conf); - -my $user = $ENV{KOHA_USER} || $xml->{config}->{user}; -my $password = $ENV{KOHA_PASS} || $xml->{config}->{pass}; +my $user = $ENV{KOHA_USER} || 'koha'; +my $password = $ENV{KOHA_PASS} || 'koha'; my $intranet = $ENV{KOHA_INTRANET_URL}; eval { use C4::Context; }; @@ -45,7 +42,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 => 30; + plan tests => 31; } my $dbh = C4::Context->dbh; diff --git a/t/db_dependent/www/batch.t b/t/db_dependent/www/batch.t index 73a41cbb922..8add67d1e35 100755 --- a/t/db_dependent/www/batch.t +++ b/t/db_dependent/www/batch.t @@ -20,8 +20,8 @@ use Modern::Perl; use utf8; use Test::More; #See plan tests => \d+ below +use Test::NoWarnings; use Test::WWW::Mechanize; -use XML::Simple; use JSON; use File::Basename; use File::Spec; @@ -31,9 +31,6 @@ use Koha::BackgroundJobs; my $testdir = File::Spec->rel2abs( dirname(__FILE__) ); -my $koha_conf = $ENV{KOHA_CONF}; -my $xml = XMLin($koha_conf); - use C4::Context; my $marcflavour = C4::Context->preference('marcflavour') || 'MARC21'; @@ -42,8 +39,8 @@ my $file = ? "$testdir/data/unimarcrecord.mrc" : "$testdir/data/marc21record.mrc"; -my $user = $ENV{KOHA_USER} || $xml->{config}->{user}; -my $password = $ENV{KOHA_PASS} || $xml->{config}->{pass}; +my $user = $ENV{KOHA_USER} || 'koha'; +my $password = $ENV{KOHA_PASS} || 'koha'; my $intranet = $ENV{KOHA_INTRANET_URL}; if ( not defined $intranet ) { @@ -52,7 +49,7 @@ if ( not defined $intranet ) { . "KOHA_CONF set, you must also set KOHA_USER and KOHA_PASS for " . "your username and password"; } else { - plan tests => 24; + plan tests => 25; } $intranet =~ s#/$##; diff --git a/t/db_dependent/www/history.t b/t/db_dependent/www/history.t index af83692647f..c0501cfb422 100755 --- a/t/db_dependent/www/history.t +++ b/t/db_dependent/www/history.t @@ -18,17 +18,14 @@ use Modern::Perl; use utf8; -use XML::Simple; use Encode; use Test::More; #See plan tests => \d+ below +use Test::NoWarnings; use Test::WWW::Mechanize; -my $koha_conf = $ENV{KOHA_CONF}; -my $xml = XMLin($koha_conf); - -my $user = $ENV{KOHA_USER} || $xml->{config}->{user}; -my $password = $ENV{KOHA_PASS} || $xml->{config}->{pass}; +my $user = $ENV{KOHA_USER} || 'koha'; +my $password = $ENV{KOHA_PASS} || 'koha'; my $intranet = $ENV{KOHA_INTRANET_URL}; eval { use C4::Context; }; @@ -37,7 +34,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 => 4; + plan tests => 5; } $intranet =~ s#/$##; diff --git a/t/db_dependent/www/search_utf8.t b/t/db_dependent/www/search_utf8.t index 3295eedc873..3629c576ade 100755 --- a/t/db_dependent/www/search_utf8.t +++ b/t/db_dependent/www/search_utf8.t @@ -19,9 +19,9 @@ use Modern::Perl; use utf8; use Test::More; #See plan tests => \d+ below +use Test::NoWarnings; use Test::WWW::Mechanize; use Data::Dumper; -use XML::Simple; use File::Basename qw(dirname ); use POSIX; use Encode; @@ -64,7 +64,7 @@ if ( not $intranet ) { elsif ( not $opac ) { plan skip_all => "Tests skip. You must set env. variable KOHA_OPAC_URL to do tests\n"; } else { - plan tests => 80; + plan tests => 81; } $intranet =~ s#/$##; @@ -94,8 +94,8 @@ if ( not defined $mock_zebra->{indexer_pid} ) { our $agent = Test::WWW::Mechanize->new( autocheck => 1 ); $agent->get_ok( "$intranet/cgi-bin/koha/mainpage.pl", 'connect to intranet' ); $agent->form_name('loginform'); -$agent->field( 'login_userid', $ENV{KOHA_PASS} ); -$agent->field( 'login_password', $ENV{KOHA_USER} ); +$agent->field( 'login_userid', $ENV{KOHA_PASS} || 'koha' ); +$agent->field( 'login_password', $ENV{KOHA_USER} || 'koha' ); $agent->field( 'branch', '' ); $agent->click_ok( '', 'login to staff interface' ); -- 2.34.1