From b9b80b9471ac0b92556c640b3601d8317586f54c Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 16 Jun 2026 00:26:43 +0000 Subject: [PATCH] Bug 31391: Implement UseRecalls choices in tests Signed-off-by: David Nind Signed-off-by: Katrin Fischer Signed-off-by: Pedro Amorim --- t/db_dependent/Circulation.t | 8 ++++---- t/db_dependent/Circulation/transferbook.t | 2 +- t/db_dependent/Koha/Biblio.t | 4 ++-- t/db_dependent/Koha/Item.t | 12 ++++++------ t/db_dependent/SIP/Transaction.t | 2 +- t/db_dependent/Search.t | 2 +- t/db_dependent/XSLT.t | 4 ++-- 7 files changed, 17 insertions(+), 17 deletions(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 2222efb262..3ad7351987 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -1911,7 +1911,7 @@ subtest "CanBookBeRenewed tests" => sub { t::lib::Mocks::mock_preference( 'FineNoRenewals', 0 ); # Recalls - t::lib::Mocks::mock_preference( 'UseRecalls', 1 ); + t::lib::Mocks::mock_preference( 'UseRecalls', 'opac' ); Koha::CirculationRules->set_rules( { categorycode => undef, @@ -2877,7 +2877,7 @@ subtest 'AddIssue & AllowReturnToBranch' => sub { subtest 'AddIssue | recalls' => sub { plan tests => 3; - t::lib::Mocks::mock_preference( "UseRecalls", 1 ); + t::lib::Mocks::mock_preference( "UseRecalls", 'opac' ); t::lib::Mocks::mock_preference( "item-level_itypes", 1 ); my $patron1 = $builder->build_object( { class => 'Koha::Patrons' } ); my $patron2 = $builder->build_object( { class => 'Koha::Patrons' } ); @@ -5691,7 +5691,7 @@ subtest 'CanBookBeIssued | notforloan' => sub { subtest 'CanBookBeIssued | recalls' => sub { plan tests => 3; - t::lib::Mocks::mock_preference( "UseRecalls", 1 ); + t::lib::Mocks::mock_preference( "UseRecalls", 'opac' ); t::lib::Mocks::mock_preference( "item-level_itypes", 1 ); my $patron1 = $builder->build_object( { class => 'Koha::Patrons' } ); my $patron2 = $builder->build_object( { class => 'Koha::Patrons' } ); @@ -5900,7 +5900,7 @@ subtest 'AddReturn should clear items.onloan for unissued items' => sub { subtest 'AddReturn | recalls' => sub { plan tests => 3; - t::lib::Mocks::mock_preference( "UseRecalls", 1 ); + t::lib::Mocks::mock_preference( "UseRecalls", 'opac' ); t::lib::Mocks::mock_preference( "item-level_itypes", 1 ); my $patron1 = $builder->build_object( { class => 'Koha::Patrons' } ); my $patron2 = $builder->build_object( { class => 'Koha::Patrons' } ); diff --git a/t/db_dependent/Circulation/transferbook.t b/t/db_dependent/Circulation/transferbook.t index 70f4e119d6..c57c2b403a 100755 --- a/t/db_dependent/Circulation/transferbook.t +++ b/t/db_dependent/Circulation/transferbook.t @@ -168,7 +168,7 @@ subtest 'transfer already at destination' => sub { is( $messages->{ResFound}->{itemnumber}, $item->itemnumber, "We got the reserve info" ); # recalls - t::lib::Mocks::mock_preference( 'UseRecalls', 1 ); + t::lib::Mocks::mock_preference( 'UseRecalls', 'opac' ); my $recall = Koha::Recall->new( { biblio_id => $item->biblionumber, diff --git a/t/db_dependent/Koha/Biblio.t b/t/db_dependent/Koha/Biblio.t index 8c1465a558..f0723ca665 100755 --- a/t/db_dependent/Koha/Biblio.t +++ b/t/db_dependent/Koha/Biblio.t @@ -1871,10 +1871,10 @@ subtest 'Recalls tests' => sub { is( $recalls->count, 3, 'Correctly get number of recalls for biblio' ); is( $recalls->filter_by_current->count, 1, 'Correctly get number of active recalls for biblio' ); - t::lib::Mocks::mock_preference( 'UseRecalls', 0 ); + t::lib::Mocks::mock_preference( "UseRecalls", "off" ); is( $biblio->can_be_recalled( { patron => $patron1 } ), 0, "Can't recall with UseRecalls disabled" ); - t::lib::Mocks::mock_preference( "UseRecalls", 1 ); + t::lib::Mocks::mock_preference( "UseRecalls", "opac" ); $item1->update( { notforloan => 1 } ); is( $biblio->can_be_recalled( { patron => $patron1 } ), 0, "Can't recall with no available items" ); diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t index 12f9409e15..793f4733b6 100755 --- a/t/db_dependent/Koha/Item.t +++ b/t/db_dependent/Koha/Item.t @@ -57,7 +57,7 @@ subtest '_status() tests' => sub { my $library = $builder->build_object( { class => 'Koha::Libraries' } ); t::lib::Mocks::mock_userenv( { branchcode => $library->branchcode } ); - t::lib::Mocks::mock_preference( 'UseRecalls', 1 ); + t::lib::Mocks::mock_preference( 'UseRecalls', 'opac' ); my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); @@ -188,7 +188,7 @@ subtest '_status() tests' => sub { } } - t::lib::Mocks::mock_preference( 'UseRecalls', 0 ); + t::lib::Mocks::mock_preference( 'UseRecalls', 'off' ); $schema->storage->txn_rollback; }; @@ -2994,7 +2994,7 @@ subtest 'Recalls tests' => sub { ); t::lib::Mocks::mock_userenv( { patron => $patron1 } ); - t::lib::Mocks::mock_preference( 'UseRecalls', 1 ); + t::lib::Mocks::mock_preference( 'UseRecalls', 'opac' ); my $recall1 = Koha::Recall->new( { @@ -3024,10 +3024,10 @@ subtest 'Recalls tests' => sub { $recall2->set_cancelled; - t::lib::Mocks::mock_preference( 'UseRecalls', 0 ); + t::lib::Mocks::mock_preference( 'UseRecalls', 'off' ); is( $item1->can_be_recalled( { patron => $patron1 } ), 0, "Can't recall with UseRecalls disabled" ); - t::lib::Mocks::mock_preference( "UseRecalls", 1 ); + t::lib::Mocks::mock_preference( "UseRecalls", 'opac' ); $item1->update( { notforloan => 1 } ); is( $item1->can_be_recalled( { patron => $patron1 } ), 0, "Can't recall that is not for loan" ); @@ -3247,7 +3247,7 @@ subtest 'has_pending_recall() tests' => sub { my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); t::lib::Mocks::mock_userenv( { branchcode => $library->branchcode } ); - t::lib::Mocks::mock_preference( 'UseRecalls', 1 ); + t::lib::Mocks::mock_preference( 'UseRecalls', 'opac' ); C4::Circulation::AddIssue( $patron, $item->barcode ); diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t index 47f9379ad7..bc033c78d8 100755 --- a/t/db_dependent/SIP/Transaction.t +++ b/t/db_dependent/SIP/Transaction.t @@ -1557,7 +1557,7 @@ subtest do_checkout_with_recalls => sub { } ); - t::lib::Mocks::mock_preference( 'UseRecalls', 1 ); + t::lib::Mocks::mock_preference( 'UseRecalls', 'opac' ); Koha::CirculationRules->set_rule( { branchcode => undef, diff --git a/t/db_dependent/Search.t b/t/db_dependent/Search.t index 8ebcd4e2b2..8055ba5333 100755 --- a/t/db_dependent/Search.t +++ b/t/db_dependent/Search.t @@ -161,7 +161,7 @@ $contextmodule->mock( } elsif ( $pref eq 'SearchLimitLibrary' ) { return 'both'; } elsif ( $pref eq 'UseRecalls' ) { - return '0'; + return 'off'; } elsif ( $pref eq 'ContentWarningField' ) { return q{}; } elsif ( $pref eq 'AuthorLinkSortBy' ) { diff --git a/t/db_dependent/XSLT.t b/t/db_dependent/XSLT.t index 1ce78b12ae..47b537d545 100755 --- a/t/db_dependent/XSLT.t +++ b/t/db_dependent/XSLT.t @@ -202,7 +202,7 @@ subtest 'buildKohaItemsNamespace status tests' => sub { my $library_name = $holdinglibrary->branchname; like( $xml, qr{${library_name}}, "Found resultbranch / holding branch" ); - t::lib::Mocks::mock_preference( 'UseRecalls', 1 ); + t::lib::Mocks::mock_preference( 'UseRecalls', 'opac' ); my $recall = $builder->build_object( { class => 'Koha::Recalls', @@ -220,7 +220,7 @@ subtest 'buildKohaItemsNamespace status tests' => sub { $xml, qr{Recall waiting}, "Waiting status takes precedence over In transit (recalls)" ); - t::lib::Mocks::mock_preference( 'UseRecalls', 0 ); + t::lib::Mocks::mock_preference( 'UseRecalls', 'off' ); $schema->storage->txn_rollback; };