Bug 36122: Update unit test

Signed-off-by: Roman Dolny <roman.dolny@jezuici.pl>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 24abc7c997)
Signed-off-by: Fridolin Somers <fridolin.somers@biblibre.com>
This commit is contained in:
Matthias Le Gac 2024-04-05 10:12:37 -04:00 committed by Fridolin Somers
parent 4795049549
commit bdb4f0c1bb

View file

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