From bdb4f0c1bbc4b76910f64a687a40dfef00584b99 Mon Sep 17 00:00:00 2001 From: Matthias Le Gac Date: Fri, 5 Apr 2024 10:12:37 -0400 Subject: [PATCH] Bug 36122: Update unit test Signed-off-by: Roman Dolny Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer (cherry picked from commit 24abc7c9973ce4b2b91a4b53375ef233faf59304) Signed-off-by: Fridolin Somers --- t/db_dependent/Koha/Suggestions.t | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/t/db_dependent/Koha/Suggestions.t b/t/db_dependent/Koha/Suggestions.t index 467e207a92..1254248e43 100755 --- a/t/db_dependent/Koha/Suggestions.t +++ b/t/db_dependent/Koha/Suggestions.t @@ -23,7 +23,6 @@ use Test::More tests => 11; use Test::Exception; use Koha::Suggestions; -use Koha::Config::SysPrefs; use Koha::Notice::Messages; use Koha::Database; use Koha::DateUtils qw( dt_from_string output_pref ); @@ -68,8 +67,7 @@ subtest 'store' => sub { $suggestion = Koha::Suggestions->find( $suggestion->suggestionid ); is( $suggestion->suggesteddate, $two_days_ago_sql, 'If suggestion id modified, suggesteddate should not be modified' ); - my $syspref = Koha::Config::SysPrefs->find('EmailPurchaseSuggestions'); - $syspref->value(0)->store; + t::lib::Mocks::mock_preference( 'EmailPurchaseSuggestions', 0 ); Koha::Notice::Messages->search->delete; $suggestion->STATUS('ASKED')->store; my $last_message = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->single; @@ -81,8 +79,7 @@ subtest 'store' => sub { 'If EmailPurchaseSuggestions is not enabled, a message should not be sent' ); - $syspref = Koha::Config::SysPrefs->find('EmailPurchaseSuggestions'); - $syspref->value('EmailAddressForSuggestions')->store; + t::lib::Mocks::mock_preference( 'EmailPurchaseSuggestions', 'EmailAddressForSuggestions' ); Koha::Notice::Messages->search->delete; $suggestion->STATUS('ASKED')->store; $last_message = Koha::Notice::Messages->search( {}, { order_by => { -desc => 'message_id' } } )->single;