From dd516be73424f6955d8259d09b5150f7f42995f3 Mon Sep 17 00:00:00 2001
From: Matthias Le Gac <matthias.le-gac@inlibro.com>
Date: Fri, 5 Apr 2024 10:12:37 -0400
Subject: [PATCH] Bug 36122: modif test

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