Skip to content

Commit 1534574

Browse files
fridoboxricofreak
authored andcommitted
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>
1 parent 5f9ec5e commit 1534574

3 files changed

Lines changed: 9 additions & 9 deletions

File tree

t/db_dependent/Auth.t

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -527,8 +527,8 @@ subtest 'get_template_and_user' => sub { # Tests for the language URL paramet
527527
t::lib::Mocks::mock_preference( 'EnableOpacSearchHistory', 1 );
528528

529529
# Enable es-ES for the OPAC and staff interfaces
530-
t::lib::Mocks::mock_preference( 'OPACLanguages', 'en,es-ES' );
531-
t::lib::Mocks::mock_preference( 'language', 'en,es-ES' );
530+
t::lib::Mocks::mock_preference( 'OPACLanguages', 'en,es-ES' );
531+
t::lib::Mocks::mock_preference( 'StaffInterfaceLanguages', 'en,es-ES' );
532532

533533
# we need a session cookie
534534
$ENV{"SERVER_PORT"} = 80;
@@ -1192,15 +1192,15 @@ subtest 'checkpw() return values tests' => sub {
11921192
$password_expired = 1;
11931193
@return = checkpw( $patron->userid, $password, undef, );
11941194

1195-
is( scalar @return, 2, "Two results on expired password scenario" );
1195+
is( scalar @return, 2, "Two results on expired password scenario" );
11961196
is( $return[0], -2, '-2 returned' );
11971197
is( ref( $return[1] ), 'Koha::Patron' );
11981198
is( $return[1]->id, $patron->id, 'Patron matched correctly' );
11991199

12001200
t::lib::Mocks::mock_preference( 'AnonymousPatron', $patron->id );
12011201
@return = checkpw( $patron->userid, $password, undef, );
12021202

1203-
is( scalar @return, 2, "Two results on expired password scenario" );
1203+
is( scalar @return, 2, "Two results on expired password scenario" );
12041204
is( $return[0], -3, '-3 returned' );
12051205
is( ref( $return[1] ), 'Koha::Patron' );
12061206
is( $return[1]->id, $patron->id, 'Patron matched correctly' );
@@ -1284,14 +1284,14 @@ subtest 'checkpw() return values tests' => sub {
12841284
$password_expired = 1;
12851285
@return = checkpw( $patron->userid, $password, $query, );
12861286

1287-
is( scalar @return, 2, "Two results on expired password scenario" );
1287+
is( scalar @return, 2, "Two results on expired password scenario" );
12881288
is( $return[0], -2, '-2 returned' );
12891289
is( ref( $return[1] ), 'Koha::Patron' );
12901290
is( $return[1]->id, $patron->id, 'Patron matched correctly' );
12911291

12921292
t::lib::Mocks::mock_preference( 'AnonymousPatron', $patron->id );
12931293
@return = checkpw( $patron->userid, $password, undef, );
1294-
is( scalar @return, 2, "Two results on expired password scenario" );
1294+
is( scalar @return, 2, "Two results on expired password scenario" );
12951295
is( $return[0], -3, '-3 returned' );
12961296
is( ref( $return[1] ), 'Koha::Patron' );
12971297
is( $return[1]->id, $patron->id, 'Patron matched correctly' );

t/db_dependent/Koha/ItemTypes.t

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,8 @@ $type = Koha::ItemTypes->find( $child2->itemtype );
107107
ok( defined($type), 'second result' );
108108
is_deeply( $type->unblessed, $child2->unblessed, "We got back the same object" );
109109

110-
t::lib::Mocks::mock_preference( 'language', 'en' );
111-
t::lib::Mocks::mock_preference( 'OPACLanguages', 'en' );
110+
t::lib::Mocks::mock_preference( 'StaffInterfaceLanguages', 'en' );
111+
t::lib::Mocks::mock_preference( 'OPACLanguages', 'en' );
112112
my $itemtypes = Koha::ItemTypes->search_with_localization;
113113
is( $itemtypes->count, $initial_count1 + 4, 'We added 4 item types' );
114114
my $first_itemtype = $itemtypes->next;

t/db_dependent/Koha/SharedContent.t

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ my $subscription = $builder->build(
153153

154154
t::lib::Mocks::mock_userenv( { patron => $loggedinuser } );
155155

156-
t::lib::Mocks::mock_preference( 'language', 'en' );
156+
t::lib::Mocks::mock_preference( 'StaffInterfaceLanguages', 'en' );
157157

158158
$post_request = 1;
159159
$result = Koha::SharedContent::send_entity(

0 commit comments

Comments
 (0)