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'.

Signed-off-by: David Nind <david@davidnind.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 298884805a)
Signed-off-by: Paul Derscheid <paul.derscheid@lmscloud.de>
This commit is contained in:
Jonathan Druart 2025-07-15 12:45:10 +02:00 committed by Paul Derscheid
parent 897e65fe8a
commit 20de12b601
No known key found for this signature in database
GPG Key ID: C25F9FD44CED595B
4 changed files with 16 additions and 25 deletions

View File

@ -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;

View File

@ -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#/$##;

View File

@ -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#/$##;

View File

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