Bug 39745: Fix wrong system preference 'language' in test suite (mock_preference)

Bug 27490 renamed system preference language to StaffInterfaceLanguages.
Needs to be done in test suite on mock_preference calls

Test by running impacted tests

Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@openfifth.co.uk>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
(cherry picked from commit 1534574257)
Signed-off-by: Jacob O'Mara <Jacob.omara@openfifth.co.uk>
This commit is contained in:
Fridolin Somers 2025-04-25 11:46:09 +02:00 committed by Jacob O'Mara
parent 3b3e7ee90c
commit 520de088de
No known key found for this signature in database
3 changed files with 9 additions and 9 deletions

View File

@ -527,8 +527,8 @@ subtest 'get_template_and_user' => sub { # Tests for the language URL paramet
t::lib::Mocks::mock_preference( 'EnableOpacSearchHistory', 1 );
# Enable es-ES for the OPAC and staff interfaces
t::lib::Mocks::mock_preference( 'OPACLanguages', 'en,es-ES' );
t::lib::Mocks::mock_preference( 'language', 'en,es-ES' );
t::lib::Mocks::mock_preference( 'OPACLanguages', 'en,es-ES' );
t::lib::Mocks::mock_preference( 'StaffInterfaceLanguages', 'en,es-ES' );
# we need a session cookie
$ENV{"SERVER_PORT"} = 80;
@ -1192,7 +1192,7 @@ subtest 'checkpw() return values tests' => sub {
$password_expired = 1;
@return = checkpw( $patron->userid, $password, undef, );
is( scalar @return, 2, "Two results on expired password scenario" );
is( scalar @return, 2, "Two results on expired password scenario" );
is( $return[0], -2, '-2 returned' );
is( ref( $return[1] ), 'Koha::Patron' );
is( $return[1]->id, $patron->id, 'Patron matched correctly' );
@ -1200,7 +1200,7 @@ subtest 'checkpw() return values tests' => sub {
t::lib::Mocks::mock_preference( 'AnonymousPatron', $patron->id );
@return = checkpw( $patron->userid, $password, undef, );
is( scalar @return, 2, "Two results on expired password scenario" );
is( scalar @return, 2, "Two results on expired password scenario" );
is( $return[0], -3, '-3 returned' );
is( ref( $return[1] ), 'Koha::Patron' );
is( $return[1]->id, $patron->id, 'Patron matched correctly' );
@ -1284,14 +1284,14 @@ subtest 'checkpw() return values tests' => sub {
$password_expired = 1;
@return = checkpw( $patron->userid, $password, $query, );
is( scalar @return, 2, "Two results on expired password scenario" );
is( scalar @return, 2, "Two results on expired password scenario" );
is( $return[0], -2, '-2 returned' );
is( ref( $return[1] ), 'Koha::Patron' );
is( $return[1]->id, $patron->id, 'Patron matched correctly' );
t::lib::Mocks::mock_preference( 'AnonymousPatron', $patron->id );
@return = checkpw( $patron->userid, $password, undef, );
is( scalar @return, 2, "Two results on expired password scenario" );
is( scalar @return, 2, "Two results on expired password scenario" );
is( $return[0], -3, '-3 returned' );
is( ref( $return[1] ), 'Koha::Patron' );
is( $return[1]->id, $patron->id, 'Patron matched correctly' );

View File

@ -107,8 +107,8 @@ $type = Koha::ItemTypes->find( $child2->itemtype );
ok( defined($type), 'second result' );
is_deeply( $type->unblessed, $child2->unblessed, "We got back the same object" );
t::lib::Mocks::mock_preference( 'language', 'en' );
t::lib::Mocks::mock_preference( 'OPACLanguages', 'en' );
t::lib::Mocks::mock_preference( 'StaffInterfaceLanguages', 'en' );
t::lib::Mocks::mock_preference( 'OPACLanguages', 'en' );
my $itemtypes = Koha::ItemTypes->search_with_localization;
is( $itemtypes->count, $initial_count1 + 4, 'We added 4 item types' );
my $first_itemtype = $itemtypes->next;

View File

@ -153,7 +153,7 @@ my $subscription = $builder->build(
t::lib::Mocks::mock_userenv( { patron => $loggedinuser } );
t::lib::Mocks::mock_preference( 'language', 'en' );
t::lib::Mocks::mock_preference( 'StaffInterfaceLanguages', 'en' );
$post_request = 1;
$result = Koha::SharedContent::send_entity(